Skip to content

Commit

Permalink
Merge pull request #83 from uatisdeproblem/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
uatisdeproblem authored Mar 6, 2024
2 parents 4897693 + 60c80f4 commit 3bb6c18
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 19 deletions.
1 change: 0 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"type": "node",
"request": "launch",
"name": "Start local app",
"noDebug": true,
"console": "integratedTerminal",
"cwd": "${workspaceRoot}/front-end",
"runtimeExecutable": "npm",
Expand Down
4 changes: 2 additions & 2 deletions back-end/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion back-end/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.8.5",
"version": "1.8.6",
"name": "back-end",
"scripts": {
"lint": "eslint --ext .ts",
Expand Down
6 changes: 2 additions & 4 deletions back-end/src/models/votingSession.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,10 @@ export class VotingSession extends Resource {
e.push('publishedSince');
if (this.iE(this.ballots)) e.push('ballots');
if (this.iE(this.voters)) e.push('voters');
const votersIds = this.voters.map(x => x.id);
const votersNames = this.voters.map(x => x.name);
const votersEmails = this.voters.map(x => x.email?.toLowerCase()).filter(x => x);
const votersIds = this.voters.map(x => x.id?.trim());
const votersNames = this.voters.map(x => x.name?.trim().toLowerCase());
if (votersIds.length !== new Set(votersIds).size) e.push('voters.duplicatedIds');
if (votersNames.length !== new Set(votersNames).size) e.push('voters.duplicatedNames');
if (votersEmails.length !== new Set(votersEmails).size) e.push('voters.duplicatedEmails');
if (this.startsAt) {
const tenMinutes = new Date();
tenMinutes.setMinutes(tenMinutes.getMinutes() + 10);
Expand Down
2 changes: 1 addition & 1 deletion back-end/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.0.3

info:
title: ESN Assembly app
version: 1.8.5
version: 1.8.6
contact:
name: Matteo Carbone
email: [email protected]
Expand Down
4 changes: 2 additions & 2 deletions front-end/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion front-end/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "esn-assembly",
"version": "1.8.5",
"version": "1.8.6",
"author": "Matteo Carbone",
"homepage": "https://matteocarbone.com/",
"scripts": {
Expand Down
25 changes: 20 additions & 5 deletions front-end/src/app/tabs/voting/manageSession.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -269,23 +269,38 @@ <h2>{{ 'VOTING.SCRUTINEERS' | translate }}</h2>
[icon]="hasFieldAnError('voters.duplicatedIds') ? 'close' : 'checkmark'"
[color]="hasFieldAnError('voters.duplicatedIds') ? 'danger' : 'success'"
/>
<ion-label class="ion-text-wrap">{{ 'VOTING.THERE_ARE_NO_DUPLICATE_VOTERS_IDS' | translate }}</ion-label>
<ion-label class="ion-text-wrap">
{{ 'VOTING.THERE_ARE_NO_DUPLICATE_VOTERS_IDS' | translate }}
<p>{{ getVotersDuplicatedIds().join(', ') }}</p>
</ion-label>
</ion-item>
<ion-item>
<ion-icon
slot="start"
[icon]="hasFieldAnError('voters.duplicatedNames') ? 'close' : 'checkmark'"
[color]="hasFieldAnError('voters.duplicatedNames') ? 'danger' : 'success'"
/>
<ion-label class="ion-text-wrap">{{ 'VOTING.THERE_ARE_NO_DUPLICATE_VOTERS_NAMES' | translate }}</ion-label>
<ion-label class="ion-text-wrap">
{{ 'VOTING.THERE_ARE_NO_DUPLICATE_VOTERS_NAMES' | translate }}
<p>{{ getVotersDuplicatedNames().join(', ') }}</p>
</ion-label>
</ion-item>
<ion-item>
<ion-icon
slot="start"
[icon]="hasFieldAnError('voters.duplicatedEmails') ? 'close' : 'checkmark'"
[color]="hasFieldAnError('voters.duplicatedEmails') ? 'danger' : 'success'"
[icon]="getVotersDuplicatedEmails().length ? 'warning' : 'checkmark'"
[color]="getVotersDuplicatedEmails().length ? 'warning' : 'success'"
/>
<ion-label class="ion-text-wrap">
{{ 'VOTING.THERE_ARE_NO_DUPLICATE_VOTERS_EMAILS' | translate }}
<p>{{ getVotersDuplicatedEmails().join(', ') }}</p>
</ion-label>
<idea-show-hint-button
slot="end"
hint="VOTING.DUPLICATED_EMAILS_AVOID_CONFUSION"
*ngIf="getVotersDuplicatedEmails().length"
translate
/>
<ion-label class="ion-text-wrap">{{ 'VOTING.THERE_ARE_NO_DUPLICATE_VOTERS_EMAILS' | translate }}</ion-label>
</ion-item>
<ion-item>
<ion-icon
Expand Down
21 changes: 21 additions & 0 deletions front-end/src/app/tabs/voting/manageSession.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,27 @@ export class ManageVotingSessionPage implements OnDestroy {
// START
//

private getDuplicatesOfList(list: string[], includeEmptyElements = false): string[] {
if (!includeEmptyElements) list = list.filter(x => x);
const uniqueStack = new Set(list);
return Array.from(
new Set(
list.filter(x => {
if (uniqueStack.has(x)) uniqueStack.delete(x);
else return true;
})
)
);
}
getVotersDuplicatedIds(): string[] {
return this.getDuplicatesOfList(this.votingSession.voters.map(x => x.id?.trim()));
}
getVotersDuplicatedNames(): string[] {
return this.getDuplicatesOfList(this.votingSession.voters.map(x => x.name?.trim().toLowerCase()));
}
getVotersDuplicatedEmails(): string[] {
return this.getDuplicatesOfList(this.votingSession.voters.map(x => x.email?.trim().toLowerCase()));
}
getNameOfVotersWithoutEmail(): string[] {
return this.votingSession.voters.filter(x => !x.email).map(x => x.name);
}
Expand Down
4 changes: 3 additions & 1 deletion front-end/src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"LIVE_ON": "Live on",
"STATUS": "Status",
"STATUSES": {
"DRAFT":"Draft",
"DRAFT": "Draft",
"OPEN": "Open",
"CLOSED": "Closed"
},
Expand Down Expand Up @@ -773,6 +773,8 @@
"VOTERS_AUDIT": "Voters audit",
"ABSENT": "Absent",
"PARTICIPATION": "Participation",
"DUPLICATED_EMAILS_AVOID_CONFUSION": "There are repeated emails",
"DUPLICATED_EMAILS_AVOID_CONFUSION_I": "Receiving two or more voting links to the same email addresses may lead to confusion; it's suggested that each voter use a different email address.",
"THESE_VOTERS_WONT_RECEIVE_VOTING_LINK": "The following voters won't receive a voting link:",
"NO_VOTING_MEANS_ABSENT": "No vote means absent",
"NO_VOTING_MEANS_ABSENT_I": "Without voting link, the voters won't be able to vote. That means they will count as absent.",
Expand Down
2 changes: 1 addition & 1 deletion front-end/src/environments/environment.idea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const STAGE = 'prod';
*/
export const environment = {
idea: {
app: { version: '1.8.5', mediaUrl: 'https://'.concat(parameters.mediaDomain), maxFileUploadSizeMB: 50 },
app: { version: '1.8.6', mediaUrl: 'https://'.concat(parameters.mediaDomain), maxFileUploadSizeMB: 50 },
api: { url: parameters.apiDomain, stage: STAGE },
socket: { url: parameters.webSocketApiDomain, stage: STAGE },
ionicExtraModules: ['common']
Expand Down

0 comments on commit 3bb6c18

Please sign in to comment.