Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#12894] Per-recipient stats are calculated based on student name, not email #12981

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,27 @@
const perRecipientResponse: Record<string, Record<string, number>> = {};
const recipientToTeam: Record<string, string> = {};
const recipientEmails: Record<string, string> = {};
const recipientNames: Record<string, string> = {};
for (const response of this.responses) {
perRecipientResponse[response.recipient] = perRecipientResponse[response.recipient] || {};
recipientEmails[response.recipient] = recipientEmails[response.recipient] || response.recipientEmail || '';
if(!response.recipientEmail){

Check failure on line 96 in src/web/app/components/question-types/question-statistics/question-statistics-calculation/msq-question-statistics-calculation.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Expected space(s) after "if"

Check failure on line 96 in src/web/app/components/question-types/question-statistics/question-statistics-calculation/msq-question-statistics-calculation.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Missing space before opening brace

Check failure on line 96 in src/web/app/components/question-types/question-statistics/question-statistics-calculation/msq-question-statistics-calculation.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Expected space(s) after "if"

Check failure on line 96 in src/web/app/components/question-types/question-statistics/question-statistics-calculation/msq-question-statistics-calculation.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Missing space before opening brace
continue;
}
perRecipientResponse[response.recipientEmail] = perRecipientResponse[response.recipientEmail] || {};
recipientEmails[response.recipientEmail] = recipientEmails[response.recipientEmail] || response.recipientEmail || '';

Check failure on line 100 in src/web/app/components/question-types/question-statistics/question-statistics-calculation/msq-question-statistics-calculation.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

This line has a length of 123. Maximum allowed is 120

Check failure on line 100 in src/web/app/components/question-types/question-statistics/question-statistics-calculation/msq-question-statistics-calculation.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

This line has a length of 123. Maximum allowed is 120
recipientNames[response.recipientEmail] = recipientNames[response.recipientEmail] || response.recipient || '';
for (const choice of this.question.msqChoices) {
perRecipientResponse[response.recipient][choice] = 0;
perRecipientResponse[response.recipientEmail][choice] = 0;
}
if (this.question.otherEnabled) {
perRecipientResponse[response.recipient]['Other'] = 0;
perRecipientResponse[response.recipientEmail]['Other'] = 0;
}
recipientToTeam[response.recipient] = response.recipientTeam;
recipientToTeam[response.recipientEmail] = response.recipientTeam;
}
for (const response of this.responses) {
this.updateResponseCountPerOptionForResponse(response.responseDetails, perRecipientResponse[response.recipient]);
if(!response.recipientEmail){

Check failure on line 111 in src/web/app/components/question-types/question-statistics/question-statistics-calculation/msq-question-statistics-calculation.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Expected space(s) after "if"

Check failure on line 111 in src/web/app/components/question-types/question-statistics/question-statistics-calculation/msq-question-statistics-calculation.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Missing space before opening brace

Check failure on line 111 in src/web/app/components/question-types/question-statistics/question-statistics-calculation/msq-question-statistics-calculation.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Expected space(s) after "if"

Check failure on line 111 in src/web/app/components/question-types/question-statistics/question-statistics-calculation/msq-question-statistics-calculation.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Missing space before opening brace
continue;
}
this.updateResponseCountPerOptionForResponse(response.responseDetails, perRecipientResponse[response.recipientEmail]);

Check failure on line 114 in src/web/app/components/question-types/question-statistics/question-statistics-calculation/msq-question-statistics-calculation.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

This line has a length of 124. Maximum allowed is 120

Check failure on line 114 in src/web/app/components/question-types/question-statistics/question-statistics-calculation/msq-question-statistics-calculation.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

This line has a length of 124. Maximum allowed is 120
}

for (const recipient of Object.keys(perRecipientResponse)) {
Expand All @@ -120,7 +128,7 @@
average = numOfResponsesForRecipient ? total / numOfResponsesForRecipient : 0;

this.perRecipientResponses[recipient] = {
recipient,
recipient: recipientNames[recipient],
recipientEmail: recipientEmails[recipient],
total: +total.toFixed(5),
average: +average.toFixed(2),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
}
],
"expectedPerRecipientResponses": {
"Alice": {
"alice@gmail.com": {
"average": 1.5,
"recipient": "Alice",
"recipientEmail": "alice@gmail.com",
Expand All @@ -112,7 +112,7 @@
},
"total": 3
},
"Bob": {
"bob@gmail.com": {
"average": 1,
"recipient": "Bob",
"recipientEmail": "bob@gmail.com",
Expand All @@ -124,7 +124,7 @@
},
"total": 1
},
"Charles": {
"charles@gmail.com": {
"average": 0,
"recipient": "Charles",
"recipientEmail": "charles@gmail.com",
Expand Down