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

Student: view results: rank questions: show average #8701 #8784

Merged

Conversation

nidhi98gupta
Copy link
Contributor

@nidhi98gupta nidhi98gupta commented Apr 14, 2018

Fixes #8701

Statistics to student is only shown when instructor sets required visibility settings i.e. visibility setting is permissive enough (i.e., if the ranks for all team members are in the results bundle).

Screenshot of changes
rank

@whipermr5 whipermr5 added the s.Ongoing The PR is being worked on by the author(s) label Apr 15, 2018
@joanneong joanneong self-assigned this Apr 16, 2018
@nidhi98gupta
Copy link
Contributor Author

I have end semester examination next week so I'll resume work on this PR after a few days.
Apologies for the delay.

@nidhi98gupta
Copy link
Contributor Author

@joanneong Rank recipient review is ready. Would you prefer to review this first or after I make changes in rank (option) question too?

@joanneong
Copy link
Contributor

@nidhi98gupta If you don't mind waiting a couple more days, I should be able to take a look at this by the end of this week :)

@joanneong
Copy link
Contributor

@nidhi98gupta My apologies for the delay - the end of the school semester is always chaotic. I will try to give you a full review by tomorrow, but in the meantime, could you upload some screenshots/ gif of the changes that you have made so that it's easier for other reviewers as well? :)

@joanneong joanneong self-requested a review May 13, 2018 16:14
@nidhi98gupta
Copy link
Contributor Author

Hi @joanneong, I have added screenshot in PR description.

@joanneong joanneong 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 May 23, 2018
Copy link
Contributor

@joanneong joanneong left a comment

Choose a reason for hiding this comment

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

Overall the current code that is here is okay. However, while testing, I realised a problem:

  1. Create a feedback form that asks students in the course to give feedback to instructors in the course
  2. Make the visibility setting "Shown anonymously to recipient and team members, visible to instructor

There is an error when a student tries to view his/her responses for such a question. More specifically, the error is a NullPointerException, so there are probably logic holes in your FeedbackRankRecipientsQuestionDetails.java.

Try to resolve it first, otherwise, I can try to look for the root cause as well. Sorry for the late review! :(

@@ -995,7 +995,7 @@ <h4 class="modal-title">
</table>
</div>
<div class="form-group">
<div class="panel panel-default panel-body content-editor" id="responsecommenttext-1-0-1-1-1" spellcheck="false" style="position: relative;">
<div class="panel panel-default panel-body content-editor empty" id="responsecommenttext-1-0-1-1-1" spellcheck="false" style="position: relative;">
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this change necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know why this file got changed in God Mode. Reverting it.

Copy link
Member

Choose a reason for hiding this comment

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

It's happening quite often and is an unrelated GodMode change. I am investigating it.

I am guessing the test is unstable and hence fails and corrects the HTML files at times (which shouldn't happen)

@joanneong joanneong 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 May 27, 2018
@nidhi98gupta
Copy link
Contributor Author

@joanneong Ready for review.

@nidhi98gupta
Copy link
Contributor Author

@joanneong A reminder.

Copy link
Contributor

@xpdavid xpdavid left a comment

Choose a reason for hiding this comment

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

Again It's me :D

@@ -238,6 +239,79 @@ public String getQuestionAdditionalInfoHtml(int questionNumber,
Slots.QUESTION_ADDITIONAL_INFO, additionalInfo);
}

private List<FeedbackResponseAttributes> getActualResponses(
Copy link
Contributor

Choose a reason for hiding this comment

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

response param in getQuestionResultStatisticsHtml already contains the response of the question?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

response param contains only limited number of responses sufficient to show responses received by student but not sufficient to build statistics.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then please give a better name. I would make more sense to add this method in FeedbackSessionResultsBundle.java. In that case, please also add some unit tests.
getAllResponsesForQuestion(question)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure where to add unit tests. Please help.

return responses;
}

private String getStudentQuestionResultsStatisticsHtml(
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a Javadoc although it is a private method.
State the behaviour of the method.

Map<String, Integer> recipientSelfRanks = generateSelfRankForEachRecipient(actualResponses);

String fragmentTemplateToUse = FormTemplates.RANK_RESULT_STATS_RECIPIENTFRAGMENT;
String templateToUse = FormTemplates.RANK_RESULT_RECIPIENT_STATS;
Copy link
Contributor

Choose a reason for hiding this comment

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

Use the constant directly.


String statsTitle = isRecipientTypeTeam ? "Summary of responses received by your team"
: "Summary of responses received by you";
return Templates.populateTemplate(templateToUse,
Copy link
Contributor

Choose a reason for hiding this comment

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

FormTemplates.RANK_RESULT_RECIPIENT_STATS

String selfRank = recipientSelfRanks.containsKey(currentUserIdentifier)
? Integer.toString(recipientSelfRanks.get(currentUserIdentifier)) : "-";

fragments.append(Templates.populateTemplate(fragmentTemplateToUse,
Copy link
Contributor

Choose a reason for hiding this comment

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

FormTemplates.RANK_RESULT_STATS_RECIPIENTFRAGMENT;

Slots.RANK_EXCLUDING_SELF_OVERALL, overallRankExceptSelf));

String statsTitle = isRecipientTypeTeam ? "Summary of responses received by your team"
: "Summary of responses received by you";
Copy link
Contributor

Choose a reason for hiding this comment

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

Summary of responses you received

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Numerical questions statistics has Summary of responses received by you. Title should be consistent?

<div class="row">
<div class="col-sm-4 text-color-gray">
<strong>
Summary of responses received by you
Copy link
Contributor

Choose a reason for hiding this comment

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

Testing situation for team?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added test for team.

@xpdavid xpdavid self-assigned this Jun 11, 2018
@@ -238,6 +239,79 @@ public String getQuestionAdditionalInfoHtml(int questionNumber,
Slots.QUESTION_ADDITIONAL_INFO, additionalInfo);
}

private List<FeedbackResponseAttributes> getActualResponses(
Copy link
Contributor

Choose a reason for hiding this comment

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

Then please give a better name. I would make more sense to add this method in FeedbackSessionResultsBundle.java. In that case, please also add some unit tests.
getAllResponsesForQuestion(question)

String questionId = question.getId();
//Get all actual responses for this question.
responses = new ArrayList<>();
for (FeedbackResponseAttributes response : bundle.actualResponses) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can make use of .stream().filter.... in Java8

@nidhi98gupta
Copy link
Contributor Author

@xpdavid Reminder to review.

/**
* Returns list of responses sorted by giverName > recipientName > qnNumber with identities
* of giver/recipients NOT hidden which is used for anonymous result calculation.
* @param question question whose responses are required
Copy link
Contributor

Choose a reason for hiding this comment

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

empty line between javadoc and param description

/**
* Returns list of unsorted responses with identities of giver/recipients NOT hidden which is used for
* anonymous result calculation.
* @param question question whose responses are required
Copy link
Contributor

Choose a reason for hiding this comment

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

same here.

return "";
}

StringBuilder fragments = new StringBuilder();
Copy link
Contributor

Choose a reason for hiding this comment

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

Put variable declaration to L296

List<String> allResponsesString = new ArrayList<>();
allResponsesString.add(allResponses.get(0).toString());
allResponsesString.add(allResponses.get(1).toString());
assertTrue("Responses are missing", allResponsesString.containsAll(allExpectedResponses));
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use assertEquals()

"INSTRUCTORS"
]
},
"qn4InSession1InCourse1": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Put test data here only if they are necessary. If you are only going to question 1, 3 (why not 2?) and their corresponding responses, there is no need to have question 2,4,5.

"isClosingEmailEnabled": true,
"isPublishedEmailEnabled": true
},
"session2InCourse1": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same for session

"sessionLevel": {}
}
},
"instructor2OfCourse1": {
Copy link
Contributor

Choose a reason for hiding this comment

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

And instructor

"email": "helper@course1.tmt",
"institute": "TEAMMATES Test Institute 1"
},
"student1InCourse1": {
Copy link
Contributor

Choose a reason for hiding this comment

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

account

@nidhi98gupta
Copy link
Contributor Author

@xpdavid Ready for review.

Copy link
Contributor

@xpdavid xpdavid left a comment

Choose a reason for hiding this comment

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

Good work.

@joanneong anything to add on?

@xpdavid xpdavid 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 Jul 21, 2018
Copy link
Contributor

@joanneong joanneong left a comment

Choose a reason for hiding this comment

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

Looks pretty ready to me. I checked both the functionality and the code quality, and I've only two comments below :)

*/
private String getStudentQuestionResultsStatisticsHtml(String studentEmail, FeedbackQuestionAttributes question,
FeedbackSessionResultsBundle bundle) {
// at least should be able to viewed by other students for team recipient
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor nit: "at least should be able to be viewed by..."

"nationality": "American",
"gender": "male",
"moreInfo": "I am just a student :P",
"pictureKey": "asdf34&hfn3!@"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can I just check why there are two different "institute"s for student1InCourse1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's a mistake. I'll fix it.

@nidhi98gupta
Copy link
Contributor Author

@joanneong Ready for review.

Copy link
Contributor

@joanneong joanneong left a comment

Choose a reason for hiding this comment

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

LGTM :)

@damithc , @wkurniawan07 , a final review?

@joanneong joanneong added s.FinalReview The PR is ready for final review and removed s.ToReview The PR is waiting for review(s) labels Jul 23, 2018
Copy link
Contributor

@damithc damithc left a comment

Choose a reason for hiding this comment

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

Code quality seem fine 👍

@joanneong
Copy link
Contributor

@damithc We still have to wait for wilson's review right :P

@damithc
Copy link
Contributor

damithc commented Jul 24, 2018

@damithc We still have to wait for wilson's review right :P

@wkurniawan07 have a look if you have time (optional).

@joanneong as @xpdavid has approved the PR, you can merge tonight if there are no change requests from @wkurniawan07 by then.

@xpdavid
Copy link
Contributor

xpdavid commented Jul 25, 2018

Merge now. If there are any comments by @wkurniawan07, can discuss here.

@xpdavid xpdavid added s.ToMerge The PR is approved by all reviewers including final reviewer; ready for merging and removed s.FinalReview The PR is ready for final review labels Jul 25, 2018
@xpdavid xpdavid merged commit b3f4581 into TEAMMATES:master Jul 25, 2018
@xpdavid xpdavid added s.FinalReview The PR is ready for final review c.Feature User-facing feature; can be new feature or enhancement to existing feature and removed s.ToMerge The PR is approved by all reviewers including final reviewer; ready for merging labels Jul 25, 2018
jacoblipech pushed a commit to jacoblipech/teammates that referenced this pull request Jul 25, 2018
@xpdavid xpdavid added this to the V6.8.0 milestone Jul 29, 2018
@xpdavid xpdavid added s.ToMerge The PR is approved by all reviewers including final reviewer; ready for merging and removed s.FinalReview The PR is ready for final review labels Jul 29, 2018
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.

6 participants