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

[#8918] Instructor: view results: questions for ranking: show rank within team #10895

Merged
merged 13 commits into from
Feb 22, 2021

Conversation

AdithyaNarayan
Copy link
Contributor

Fixes #8918

Outline of Solution

  • Created new member fields in the rank-recipient-question-statistics-calculation class for team rank.
    • In calculateRanks, all the teams and their team members are captured in the optionsPerTeam variable, which maps team names to its team members.
    • For each team, the calculateRankPerOption is called with only the team members' responses, and the ranks within each team are calculated.
  • Likewise, the process is repeated for team rank excluding self.
  • Added test case for ranks within a team.

Screenshot
pic1
pic2

Points to Note
The solution assumes that team names are unique.

@madanalogy madanalogy added the s.ToReview The PR is waiting for review(s) label Dec 27, 2020
@rrtheonlyone rrtheonlyone self-assigned this Dec 31, 2020
Copy link
Contributor

@rrtheonlyone rrtheonlyone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR 👍

We should only be showing the team rank when it makes sense (we should check against the recipientType)

For example, when ranking teams there is no need to show team rank:

Screenshot 2020-12-31 at 6 42 45 PM

@rrtheonlyone rrtheonlyone added s.Ongoing The PR is being worked on by the author(s) and removed s.ToReview The PR is waiting for review(s) labels Dec 31, 2020
@AdithyaNarayan
Copy link
Contributor Author

Okay, thanks for the comment! I have made sure that the team ranking is shown only when the recipientType is OWN_TEAM_MEMBERS or OWN_TEAM_MEMBERS_INCLUDING_SELF.

Copy link
Contributor

@rrtheonlyone rrtheonlyone left a 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

@AdithyaNarayan
Copy link
Contributor Author

Done👍

@rrtheonlyone rrtheonlyone added s.ToReview The PR is waiting for review(s) and removed s.Ongoing The PR is being worked on by the author(s) labels Feb 7, 2021
@AdithyaNarayan
Copy link
Contributor Author

Is there anything more to do for this PR?

Copy link
Contributor

@rrtheonlyone rrtheonlyone left a 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

@rrtheonlyone rrtheonlyone added s.FinalReview The PR is ready for final review and removed s.ToReview The PR is waiting for review(s) labels Feb 21, 2021
* Loads data for testing.
*/
const loadTestData: (filename: string) => Response<FeedbackRankRecipientsResponseDetails>[] =
(filename: string): Response<FeedbackRankRecipientsResponseDetails>[] => {
Copy link
Contributor

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)
Copy link
Contributor

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}`);
Copy link
Contributor

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)

Copy link
Contributor Author

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

Copy link
Contributor

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.
Copy link
Contributor

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.
Copy link
Contributor

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

@madanalogy madanalogy self-assigned this Feb 22, 2021
@madanalogy madanalogy added s.Ongoing The PR is being worked on by the author(s) and removed s.FinalReview The PR is ready for final review labels Feb 22, 2021
@AdithyaNarayan
Copy link
Contributor Author

Addressed the comments. Thanks for the feedback

Copy link
Contributor

@madanalogy madanalogy left a 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

@madanalogy madanalogy added c.Feature User-facing feature; can be new feature or enhancement to existing feature s.ToMerge The PR is approved by all reviewers including final reviewer; ready for merging and removed s.Ongoing The PR is being worked on by the author(s) labels Feb 22, 2021
@madanalogy madanalogy added this to the V7.11.0 milestone Feb 22, 2021
@madanalogy madanalogy merged commit 4e44320 into TEAMMATES:master Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c.Feature User-facing feature; can be new feature or enhancement to existing feature s.ToMerge The PR is approved by all reviewers including final reviewer; ready for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Instructor: view results: questions for ranking: show rank within team
3 participants