Skip to content

Commit

Permalink
Allow to proceed when exclusive option is selected (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
av-alexistoledo authored Nov 27, 2023
1 parent 9f5b9c2 commit 9936da6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/av_client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ export interface ContestContent {
identifiable?: boolean
contestPositions?: ContestPositionMap
blankOptionColor?: string
customRulesets?: string[]
attachments?: Attachment[]
}

Expand Down
6 changes: 6 additions & 0 deletions lib/validators/selectionPileValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ class SelectionPileValidator {
return errors;
}

optionIsExclusive(optionReference: string) {
const current = this.contest.options.find(option => option.reference === optionReference);
return current?.exclusive;
}

isComplete(selectionPile: SelectionPile) {
const enoughVotes =
selectionPile.explicitBlank ||
(selectionPile.optionSelections.length === 1 && this.optionIsExclusive(selectionPile.optionSelections[0].reference)) ||
this.implicitlyBlank(selectionPile.optionSelections) ||
!this.tooFewSelections(selectionPile.optionSelections);
return enoughVotes && this.validate(selectionPile).length == 0;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "3.1.14",
"version": "3.1.15",
"name": "@aion-dk/js-client",
"license": "MIT",
"description": "Assembly Voting JS client",
Expand Down

0 comments on commit 9936da6

Please sign in to comment.