Skip to content

Commit

Permalink
feat(frontend): Add "Show results after deadline" option
Browse files Browse the repository at this point in the history
  • Loading branch information
Clashsoft committed Apr 20, 2024
1 parent ab6a4c2 commit 8c5b915
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,15 @@ export class ChooseEventsComponent implements OnInit {
case ShowResultOptions.AFTER_PARTICIPATING:
this.hiddenReason = this.isAdmin || this.userVoted() ? undefined : 'This is a blind poll. You can\'t see results or other user\'s votes until you participate yourself.';
break;
case ShowResultOptions.AFTER_DEADLINE: {
const deadline = this.poll.settings.deadline;
if (this.isAdmin || !deadline || new Date(deadline) < new Date()) {
this.hiddenReason = undefined;
} else {
this.hiddenReason = 'The results of this poll are hidden until the deadline is over. You can only see your own votes.';
}
break;
}
default:
this.hiddenReason = undefined;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,17 @@ <h3>{{ preset.title }}</h3>
ngbTooltip="Show results to participants after submiting their vote."></i>
</label>
</div>
<div class="form-check">
<input class="form-check-input"
type="radio" id="showAfterDeadline"
[value]="ShowResultOptions.AFTER_DEADLINE"
formControlName="showResult">
<label class="form-check-label" for="showAfterDeadline">
After deadline
<i class="bi-question-circle text-muted" placement="top"
ngbTooltip="Show results to participants after the deadline is over."></i>
</label>
</div>
<div class="form-check">
<input class="form-check-input"
type="radio"
Expand Down
1 change: 1 addition & 0 deletions libs/types/src/lib/schema/show-result-options.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export enum ShowResultOptions {
IMMEDIATELY = 'immediately',
AFTER_PARTICIPATING = 'after_participating',
AFTER_DEADLINE = 'after_deadline',
NEVER = 'never',
}

0 comments on commit 8c5b915

Please sign in to comment.