-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[#8918] Instructor: view results: questions for ranking: show rank within team #10895
[#8918] Instructor: view results: questions for ranking: show rank within team #10895
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, thanks for the comment! I have made sure that the team ranking is shown only when the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just some minor comments on the implementation/tests
Also do update the help section as well to explain what the team rank is all about
...nts/question-types/question-statistics/rank-recipients-question-statistics.component.spec.ts
Outdated
Show resolved
Hide resolved
...tatistics/question-statistics-calculation/rank-recipients-question-statistics-calculation.ts
Outdated
Show resolved
Hide resolved
Done👍 |
Is there anything more to do for this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 💯 Nice one
Apologies for delay in this @AdithyaNarayan .. should be good to go once CI passes
* Loads data for testing. | ||
*/ | ||
const loadTestData: (filename: string) => Response<FeedbackRankRecipientsResponseDetails>[] = | ||
(filename: string): Response<FeedbackRankRecipientsResponseDetails>[] => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be indented? But okay not a big deal since the lint check passes
@@ -658,6 +658,9 @@ <h4 *ngIf="displaySubsection(0, 10)">Setting Up Questions</h4> | |||
<li> | |||
<b>Overall rank</b>: the recipient's rank relative to other recipients, as computed by TEAMMATES. | |||
</li> | |||
<li> | |||
<b>Team rank</b>: the recipient's rank relative to other recipients within their own team only. (Applicable only if students rank their teammates) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brackets not needed
*/ | ||
const loadTestData: (filename: string) => Response<FeedbackRankRecipientsResponseDetails>[] = | ||
(filename: string): Response<FeedbackRankRecipientsResponseDetails>[] => { | ||
return require(`./test-data/${filename}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason why test data is stored in a separate file? I'm not entirely against the approach don't get me wrong, just that our frontend tests so far all have their data embedded in the spec.ts
file so I'm wondering if you had any particular reason for the extraction of data.
I can understand the extraction if the same data is being used by other test components but this doesn't seem to be the case. Would be better for now to just have the data as a constant variable as in other frontend tests for consistency (e.g. instructor-home-page.component.spec.ts
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just felt that the code looked bad cosmetically with sample data and decided to put it in a JSON. Reverted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could consider putting up an issue for this actually, I remember it was something I wanted to raise but didn't have the time to. That is to say, refactor frontend test data into a dedicated resource folder for reusability instead of having it nested within the spec.ts
files. We can have a community discussion about this, and if the idea is adopted start taking the approach as an epic/task.
@@ -672,6 +675,12 @@ <h4 *ngIf="displaySubsection(0, 10)">Setting Up Questions</h4> | |||
The <b>Overall Rank</b> ranks the average rank each recipient receives. | |||
For example, if recipient A received the ranks <code>(1, 2)</code> and recipient B received the ranks <code>(2, 4, 6)</code>, then recipient A and recipient B's average ranks are 1.5 and 4 respectively. By ranking these two averages, recipient A and B will get an <b>Overall Rank</b> of 1 and 2 respectively. | |||
</li> | |||
<li> | |||
The <b>Team Rank</b> works in a similar way to <b>Overall Rank</b> as it uses the average rank received to calculate the rank within the team. to the average rank each recipient receives. However, the average rank of the members are only compared to their own team members. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in the sentence, I'm assuming the period at the end of "team" was unintended
<li> | ||
The <b>Team Rank</b> works in a similar way to <b>Overall Rank</b> as it uses the average rank received to calculate the rank within the team. to the average rank each recipient receives. However, the average rank of the members are only compared to their own team members. | ||
For example, if recipient A (who is a part of team X) received the ranks <code>(1, 2)</code> and recipient B (who is a part of team X) received the ranks <code>(2, 4, 6)</code>, then recipient A and recipient B's average ranks are 1.5 and 4 respectively. By ranking these two averages, recipient A and B will get a <b>Team Rank</b> of 1 and 2 respectively. | ||
And if recipient C (who is a part of team Y) received the ranks <code>(1, 1)</code> and recipient D (who is a part of team Y) received the ranks <code>(1, 2)</code>, then recipient C and recipient D's average ranks are 1 and 1.5 respectively. By ranking these two averages, recipient C and D will get a <b>Team Rank</b> of 1 and 2 respectively. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary starting And
, can be removed
Addressed the comments. Thanks for the feedback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Will merge assuming no issues with the CI checks
Fixes #8918
Outline of Solution
rank-recipient-question-statistics-calculation
class for team rank.calculateRanks
, all the teams and their team members are captured in theoptionsPerTeam
variable, which maps team names to its team members.calculateRankPerOption
is called with only the team members' responses, and the ranks within each team are calculated.Screenshot
Points to Note
The solution assumes that team names are unique.