-
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
Student: view results: rank questions: show average #8701 #8784
Student: view results: rank questions: show average #8701 #8784
Conversation
I have end semester examination next week so I'll resume work on this PR after a few days. |
@joanneong Rank recipient review is ready. Would you prefer to review this first or after I make changes in rank (option) question too? |
@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 :) |
@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? :) |
Hi @joanneong, I have added screenshot in PR description. |
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.
Overall the current code that is here is okay. However, while testing, I realised a problem:
- Create a feedback form that asks students in the course to give feedback to instructors in the course
- 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;"> |
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.
Why is this change necessary?
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.
I don't know why this file got changed in God Mode. Reverting it.
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.
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 Ready for review. |
@joanneong A reminder. |
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.
Again It's me :D
@@ -238,6 +239,79 @@ public String getQuestionAdditionalInfoHtml(int questionNumber, | |||
Slots.QUESTION_ADDITIONAL_INFO, additionalInfo); | |||
} | |||
|
|||
private List<FeedbackResponseAttributes> getActualResponses( |
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.
response
param in getQuestionResultStatisticsHtml
already contains the response of the question
?
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.
response
param contains only limited number of responses sufficient to show responses received by student but not sufficient to build statistics.
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.
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)
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.
I am not sure where to add unit tests. Please help.
return responses; | ||
} | ||
|
||
private String getStudentQuestionResultsStatisticsHtml( |
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.
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; |
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.
Use the constant directly.
|
||
String statsTitle = isRecipientTypeTeam ? "Summary of responses received by your team" | ||
: "Summary of responses received by you"; | ||
return Templates.populateTemplate(templateToUse, |
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.
FormTemplates.RANK_RESULT_RECIPIENT_STATS
String selfRank = recipientSelfRanks.containsKey(currentUserIdentifier) | ||
? Integer.toString(recipientSelfRanks.get(currentUserIdentifier)) : "-"; | ||
|
||
fragments.append(Templates.populateTemplate(fragmentTemplateToUse, |
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.
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"; |
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.
Summary of responses you received
?
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.
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 |
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.
Testing situation for team?
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.
Added test for team.
@@ -238,6 +239,79 @@ public String getQuestionAdditionalInfoHtml(int questionNumber, | |||
Slots.QUESTION_ADDITIONAL_INFO, additionalInfo); | |||
} | |||
|
|||
private List<FeedbackResponseAttributes> getActualResponses( |
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.
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) { |
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.
Can make use of .stream().filter....
in Java8
@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 |
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.
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 |
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.
same here.
return ""; | ||
} | ||
|
||
StringBuilder fragments = new StringBuilder(); |
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.
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)); |
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.
Can we use assertEquals()
"INSTRUCTORS" | ||
] | ||
}, | ||
"qn4InSession1InCourse1": { |
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.
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": { |
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.
Same for session
"sessionLevel": {} | ||
} | ||
}, | ||
"instructor2OfCourse1": { |
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.
And instructor
"email": "helper@course1.tmt", | ||
"institute": "TEAMMATES Test Institute 1" | ||
}, | ||
"student1InCourse1": { |
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.
account
@xpdavid Ready for review. |
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.
Good work.
@joanneong anything to add on?
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 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 |
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.
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!@" |
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.
Can I just check why there are two different "institute"s for student1InCourse1
?
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.
Yes, that's a mistake. I'll fix it.
@joanneong Ready for review. |
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 :)
@damithc , @wkurniawan07 , a final review?
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.
Code quality seem fine 👍
@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. |
Merge now. If there are any comments by @wkurniawan07, can discuss here. |
…EAMMATES#8784) [TEAMMATES#8701] Student: view results: rank questions: show average (TEAMMATES#8784)
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