Skip to content

Commit

Permalink
updated analytics for dietary restrictions
Browse files Browse the repository at this point in the history
  • Loading branch information
pm3512 committed Jan 4, 2024
1 parent 6e29d96 commit 35522de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/models/Profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const Profile: Schema<IProfile> = new Schema(
design: String,
website: String,
essays: [String],
dietaryRestrictions: Array<String>,
dietaryRestrictions: [String],
shirtSize: {
type: String,
enum: Object.values(ShirtSize).concat([null]),
Expand Down
11 changes: 6 additions & 5 deletions src/services/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,12 @@ export const computeAnalytics = async (): Promise<Stats> => {

//Dietary restrictions
if (profile.dietaryRestrictions && isConfirmed) {
const restriction = profile.dietaryRestrictions;
if (!stats.dietaryRestrictions[restriction]) {
stats.dietaryRestrictions[restriction] = 0;
}
stats.dietaryRestrictions[restriction] += 1;
profile.dietaryRestrictions.forEach((restriction: string) => {
if (!stats.dietaryRestrictions[restriction]) {
stats.dietaryRestrictions[restriction] = 0;
}
stats.dietaryRestrictions[restriction] += 1;
});
}

//Count attendance modes
Expand Down

0 comments on commit 35522de

Please sign in to comment.