Skip to content

Commit

Permalink
[#8468] Feedback Session: Remove 'Never Publish' option (#8494)
Browse files Browse the repository at this point in the history
  • Loading branch information
sukanta-27 authored and whipermr5 committed Mar 16, 2018
1 parent 497bf6d commit e32eeff
Show file tree
Hide file tree
Showing 72 changed files with 200 additions and 680 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public boolean isPublished() {
if (publishTime.equals(Const.TIME_REPRESENTS_FOLLOW_VISIBLE)) {
return isVisible();
}
if (publishTime.equals(Const.TIME_REPRESENTS_LATER) || publishTime.equals(Const.TIME_REPRESENTS_NEVER)) {
if (publishTime.equals(Const.TIME_REPRESENTS_LATER)) {
return false;
}
if (publishTime.equals(Const.TIME_REPRESENTS_NOW)) {
Expand Down
7 changes: 0 additions & 7 deletions src/main/java/teammates/common/util/Const.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public final class Const {
public static final String INSTRUCTOR_FEEDBACK_RESULTS_VISIBLE_TIME_CUSTOM = "custom";
public static final String INSTRUCTOR_FEEDBACK_RESULTS_VISIBLE_TIME_ATVISIBLE = "atvisible";
public static final String INSTRUCTOR_FEEDBACK_RESULTS_VISIBLE_TIME_LATER = "later";
public static final String INSTRUCTOR_FEEDBACK_RESULTS_VISIBLE_TIME_NEVER = "never";
public static final String INSTRUCTOR_FEEDBACK_RESULTS_MISSING_RESPONSE = "No Response";

public static final String STUDENT_COURSE_STATUS_YET_TO_JOIN = "Yet to join";
Expand Down Expand Up @@ -289,8 +288,6 @@ public static class Tooltips {
"The responses for the session have been published and can now be viewed.";
public static final String STUDENT_FEEDBACK_SESSION_STATUS_NOT_PUBLISHED =
"The responses for the session have not yet been published and cannot be viewed.";
public static final String STUDENT_FEEDBACK_SESSION_STATUS_NEVER_PUBLISHED =
"The instructor has set the results for this feedback session to not be published.";

public static final String FEEDBACK_CONTRIBUTION_DIFF = "Perceived Contribution - Claimed Contribution";
public static final String FEEDBACK_CONTRIBUTION_POINTS_RECEIVED =
Expand Down Expand Up @@ -339,8 +336,6 @@ public static class Tooltips {
+ "when the session becomes visible to users.";
public static final String FEEDBACK_SESSION_RESULTSVISIBLELATER =
"Select this option if you intend to manually publish the responses for this session later on.";
public static final String FEEDBACK_SESSION_RESULTSVISIBLENEVER =
"Select this option if you intend never to publish the responses.";
public static final String FEEDBACK_SESSION_SENDOPENEMAIL =
"Select this option to automatically send an email to students to notify them "
+ "when the session is open for submission.";
Expand All @@ -362,8 +357,6 @@ public static class Tooltips {
public static final String FEEDBACK_SESSION_STATUS_NOT_PUBLISHED = "The responses for this session are not visible.";
public static final String FEEDBACK_SESSION_PUBLISHED_STATUS_PRIVATE_SESSION =
"This feedback session is not published as it is private and only visible to you.";
public static final String FEEDBACK_SESSION_STATUS_NEVER_PUBLISHED =
"The responses for this feedback session have been set to never get published.";

public static final String FEEDBACK_SESSION_INPUT_TIMEZONE =
"You should not need to change this as your timezone is auto-detected. <br><br>"
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/teammates/logic/backdoor/BackDoorLogic.java
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ private void validateInstructorPrivileges(InstructorAttributes instructor) {
private void cleanSessionData(FeedbackSessionAttributes session) {
if (session.getFeedbackSessionType().equals(FeedbackSessionType.PRIVATE)) {
session.setSessionVisibleFromTime(Const.TIME_REPRESENTS_NEVER);
session.setResultsVisibleFromTime(Const.TIME_REPRESENTS_NEVER);
session.setResultsVisibleFromTime(Const.TIME_REPRESENTS_LATER);
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/main/java/teammates/storage/entity/FeedbackSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ private void populateMissingBooleansIfRequired() {
}
}

@OnLoad
@SuppressWarnings("unused") // called by Objectify
private void adjustResultsVisibleFromTimeIfRequired() {
if (Const.TIME_REPRESENTS_NEVER.equals(getResultsVisibleFromTime())) {
setResultsVisibleFromTime(Const.TIME_REPRESENTS_LATER);
}
}

public String getFeedbackSessionName() {
return feedbackSessionName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ protected FeedbackSessionAttributes extractFeedbackSessionData(boolean isCreatin
case Const.INSTRUCTOR_FEEDBACK_RESULTS_VISIBLE_TIME_LATER:
attributes.setResultsVisibleFromTime(Const.TIME_REPRESENTS_LATER);
break;
case Const.INSTRUCTOR_FEEDBACK_RESULTS_VISIBLE_TIME_NEVER:
attributes.setResultsVisibleFromTime(Const.TIME_REPRESENTS_NEVER);
break;
default:
log.severe("Invalid sessionVisibleFrom setting " + attributes.getIdentificationString());
break;
Expand All @@ -116,7 +113,7 @@ protected FeedbackSessionAttributes extractFeedbackSessionData(boolean isCreatin
case Const.INSTRUCTOR_FEEDBACK_SESSION_VISIBLE_TIME_NEVER:
attributes.setSessionVisibleFromTime(Const.TIME_REPRESENTS_NEVER);
// Overwrite if private
attributes.setResultsVisibleFromTime(Const.TIME_REPRESENTS_NEVER);
attributes.setResultsVisibleFromTime(Const.TIME_REPRESENTS_LATER);
attributes.setFeedbackSessionType(FeedbackSessionType.PRIVATE);
break;
default:
Expand Down
6 changes: 1 addition & 5 deletions src/main/java/teammates/ui/pagedata/PageData.java
Original file line number Diff line number Diff line change
Expand Up @@ -634,9 +634,7 @@ public static String getInstructorSubmissionStatusForFeedbackSession(FeedbackSes
}

public static String getInstructorPublishedStatusForFeedbackSession(FeedbackSessionAttributes session) {
if (session.getResultsVisibleFromTime().equals(Const.TIME_REPRESENTS_NEVER)) {
return "-";
} else if (session.isPublished()) {
if (session.isPublished()) {
return "Published";
} else {
return "Not Published";
Expand Down Expand Up @@ -672,8 +670,6 @@ public static String getInstructorSubmissionsTooltipForFeedbackSession(FeedbackS
public static String getInstructorPublishedTooltipForFeedbackSession(FeedbackSessionAttributes session) {
if (session.isPrivateSession()) {
return Const.Tooltips.FEEDBACK_SESSION_PUBLISHED_STATUS_PRIVATE_SESSION;
} else if (session.getResultsVisibleFromTime().equals(Const.TIME_REPRESENTS_NEVER)) {
return Const.Tooltips.FEEDBACK_SESSION_STATUS_NEVER_PUBLISHED;
} else if (session.isPublished()) {
return Const.Tooltips.FEEDBACK_SESSION_STATUS_PUBLISHED;
} else {
Expand Down
8 changes: 1 addition & 7 deletions src/main/java/teammates/ui/pagedata/StudentHomePageData.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ private String getStudentSubmissionStatusForSession(FeedbackSessionAttributes se
}

private String getStudentPublishedStatusForSession(FeedbackSessionAttributes session) {
if (session.getResultsVisibleFromTime().equals(Const.TIME_REPRESENTS_NEVER)) {
return "-";
}

if (session.isPublished()) {
return "Published";
}
Expand Down Expand Up @@ -135,9 +131,7 @@ private String getStudentSubmissionsTooltipForSession(FeedbackSessionAttributes
}

private String getStudentPublishedTooltipForSession(FeedbackSessionAttributes session) {
if (session.getResultsVisibleFromTime().equals(Const.TIME_REPRESENTS_NEVER)) {
return Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_NEVER_PUBLISHED;
} else if (session.isPublished()) {
if (session.isPublished()) {
return Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_PUBLISHED;
} else {
return Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_NOT_PUBLISHED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public class FeedbackSessionsAdditionalSettingsFormSegment {
private List<ElementTag> responseVisibleTimeOptions;
private boolean isResponseVisibleImmediatelyChecked;
private boolean isResponseVisiblePublishManuallyChecked;
private boolean isResponseVisibleNeverChecked;

private boolean isSendClosingEmailChecked;
private boolean isSendOpeningEmailChecked;
Expand Down Expand Up @@ -75,10 +74,6 @@ public boolean isResponseVisiblePublishManuallyChecked() {
return isResponseVisiblePublishManuallyChecked;
}

public boolean isResponseVisibleNeverChecked() {
return isResponseVisibleNeverChecked;
}

public boolean isSendClosingEmailChecked() {
return isSendClosingEmailChecked;
}
Expand Down Expand Up @@ -112,7 +107,6 @@ public static FeedbackSessionsAdditionalSettingsFormSegment getDefaultFormSegmen
additionalSettings.responseVisibleTimeOptions = PageData.getTimeOptionsAsElementTags(null);
additionalSettings.isResponseVisibleImmediatelyChecked = false;
additionalSettings.isResponseVisiblePublishManuallyChecked = true;
additionalSettings.isResponseVisibleNeverChecked = false;

additionalSettings.isSendClosingEmailChecked = true;
additionalSettings.isSendOpeningEmailChecked = true;
Expand Down Expand Up @@ -165,9 +159,6 @@ private static void setResponseVisibleSettings(FeedbackSessionAttributes feedbac
additionalSettings.isResponseVisiblePublishManuallyChecked =
Const.TIME_REPRESENTS_LATER.equals(feedbackSession.getResultsVisibleFromTime())
|| Const.TIME_REPRESENTS_NOW.equals(feedbackSession.getResultsVisibleFromTime());

additionalSettings.isResponseVisibleNeverChecked = Const.TIME_REPRESENTS_NEVER.equals(
feedbackSession.getResultsVisibleFromTime());
}

private static void setSessionVisibleSettings(FeedbackSessionAttributes feedbackSession,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ private String getResultsVisibleFromText(FeedbackSessionAttributes feedbackSessi
}
} else if (feedbackSession.getResultsVisibleFromTime().equals(Const.TIME_REPRESENTS_LATER)) {
return "I want to manually publish the results.";
} else if (feedbackSession.getResultsVisibleFromTime().equals(Const.TIME_REPRESENTS_NEVER)) {
return "Never";
} else {
return TimeHelper.formatTime12H(feedbackSession.getResultsVisibleFromTimeLocal());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
title="<%= Const.Tooltips.FEEDBACK_SESSION_SESSIONVISIBLELABEL %>"
data-toggle="tooltip"
data-placement="top">
<label class="label-control">Session visible from </label>
<label class="label-control">Make session visible </label>
</div>
</div>
<div class="row radio">
Expand Down Expand Up @@ -89,7 +89,7 @@
title="<%= Const.Tooltips.FEEDBACK_SESSION_RESULTSVISIBLELABEL %>"
data-toggle="tooltip"
data-placement="top">
<label class="label-control">Responses visible from</label>
<label class="label-control">Make responses visible</label>
</div>
</div>
<div class="row radio">
Expand Down Expand Up @@ -152,29 +152,14 @@
data-toggle="tooltip"
data-placement="top">
<label for="<%= Const.ParamsNames.FEEDBACK_SESSION_RESULTSVISIBLEBUTTON %>_later">
Publish manually
Not now (publish manually)
</label>
<input type="radio" name="resultsVisibleFromButton"
id="<%= Const.ParamsNames.FEEDBACK_SESSION_RESULTSVISIBLEBUTTON %>_later"
value="<%= Const.INSTRUCTOR_FEEDBACK_RESULTS_VISIBLE_TIME_LATER %>"
<c:if test="${additionalSettings.responseVisiblePublishManuallyChecked}">checked</c:if>>
</div>
</div>
<div class="row radio">
<div class="col-xs-12"
title="<%= Const.Tooltips.FEEDBACK_SESSION_RESULTSVISIBLENEVER %>"
data-toggle="tooltip"
data-placement="top">
<label for="<%= Const.ParamsNames.FEEDBACK_SESSION_RESULTSVISIBLEBUTTON %>_never">
Never
</label>
<input type="radio"
name="<%= Const.ParamsNames.FEEDBACK_SESSION_RESULTSVISIBLEBUTTON %>"
id="<%= Const.ParamsNames.FEEDBACK_SESSION_RESULTSVISIBLEBUTTON %>_never"
value="<%= Const.INSTRUCTOR_FEEDBACK_RESULTS_VISIBLE_TIME_NEVER %>"
<c:if test="${additionalSettings.responseVisibleNeverChecked}">checked</c:if>>
</div>
</div>
</div>
</div>
</div>
Expand Down
13 changes: 4 additions & 9 deletions src/main/webapp/partials/instructorHelpSessions.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@
<div class="row">
<div class="col-md-6" data-toggle="tooltip" data-placement="top" title="Please select when you want the questions for the feedback session to be visible to users who need to participate. Note that users cannot submit their responses until the submissions opening time set below.">
<label class="label-control">
Session visible from
Make session visible
</label>
</div>
</div>
Expand Down Expand Up @@ -462,7 +462,7 @@
<div class="col-md-6 border-left-gray" id="responsesVisibleFromColumn">
<div class="row">
<div class="col-md-6" data-toggle="tooltip" data-placement="top" title="Please select when the responses for the feedback session will be visible to the designated recipients.<br>You can select the response visibility for each type of user and question later.">
<label class="label-control">Responses visible from</label>
<label class="label-control">Make responses visible</label>
</div>
</div>
<div class="row radio">
Expand Down Expand Up @@ -510,17 +510,12 @@
</div>
</div>
<div class="row radio">
<div class="col-md-4" data-toggle="tooltip" data-placement="top" title="Select this option if you intend to manually publish the session later on.">
<label for="resultsVisibleFromButton_later">Publish manually
<div class="col-md-5" data-toggle="tooltip" data-placement="top" title="Select this option if you intend to manually publish the session later on.">
<label for="resultsVisibleFromButton_later">Not now (publish manually)
</label>
<input type="radio" name="resultsVisibleFromButton" id="resultsVisibleFromButton_later" value="later">
</div>
</div>
<div class="row radio">
<div class="col-md-2" data-toggle="tooltip" data-placement="top" title="Select this option if you intend never to publish the responses.">
<label for="resultsVisibleFromButton_never">Never</label>
<input type="radio" name="resultsVisibleFromButton" id="resultsVisibleFromButton_never" value="never">
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ protected String[] createParamsCombinationForFeedbackSession(String courseId, St
typicalCase[indexOfSessionVisibleDate] = "";
typicalCase[indexOfSessionVisibleTime] = "0";

typicalCase[indexOfResultsVisibleButtonValue] = Const.INSTRUCTOR_FEEDBACK_RESULTS_VISIBLE_TIME_NEVER;
typicalCase[indexOfResultsVisibleButtonValue] = Const.INSTRUCTOR_FEEDBACK_RESULTS_VISIBLE_TIME_LATER;

typicalCase[indexOfSessionInstructionsValue] = "<script>test</script>instructions";
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public void testExecuteAndPostProcess() {
+ "<span class=\"bold\">From:</span> 2012-01-31T18:30:00Z"
+ "<span class=\"bold\"> to</span> 2014-12-31T18:30:00Z<br>"
+ "<span class=\"bold\">Session visible from:</span> 1970-11-27T00:00:00Z<br>"
+ "<span class=\"bold\">Results visible from:</span> 1970-11-27T00:00:00Z<br><br>"
+ "<span class=\"bold\">Results visible from:</span> 1970-01-01T00:00:00Z<br><br>"
+ "<span class=\"bold\">Instructions:</span> "
+ "<Text: instructions>|||"
+ "/page/instructorFeedbackAdd";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void testExecuteAndPostProcess() {
+ "<span class=\"bold\">From:</span> 2012-01-31T18:15:00Z"
+ "<span class=\"bold\"> to</span> 2014-12-31T18:15:00Z<br>"
+ "<span class=\"bold\">Session visible from:</span> 1970-11-27T00:00:00Z<br>"
+ "<span class=\"bold\">Results visible from:</span> 1970-11-27T00:00:00Z<br><br>"
+ "<span class=\"bold\">Results visible from:</span> 1970-01-01T00:00:00Z<br><br>"
+ "<span class=\"bold\">Instructions:</span> "
+ "<Text: instructions>|||/page/instructorFeedbackEditSave";
AssertHelper.assertLogMessageEquals(expectedString, a.getLogMessage());
Expand Down Expand Up @@ -139,14 +139,14 @@ public void testExecuteAndPostProcess() {
+ "<Text: instructions>|||/page/instructorFeedbackEditSave";
AssertHelper.assertLogMessageEquals(expectedString, a.getLogMessage());

______TS("success: Masquerade mode, never release results, invalid timezone and graceperiod");
______TS("success: Masquerade mode, manual release results, invalid timezone and graceperiod");

String adminUserId = "admin.user";
gaeSimulation.loginAsAdmin(adminUserId);

params = createParamsForTypicalFeedbackSession(instructor1ofCourse1.courseId,
session.getFeedbackSessionName());
params[19] = Const.INSTRUCTOR_FEEDBACK_RESULTS_VISIBLE_TIME_NEVER;
params[19] = Const.INSTRUCTOR_FEEDBACK_RESULTS_VISIBLE_TIME_LATER;
params[25] = " ";
params[27] = "12dsf";

Expand All @@ -168,7 +168,7 @@ public void testExecuteAndPostProcess() {
+ "<span class=\"bold\">From:</span> 2012-02-01T00:00:00Z"
+ "<span class=\"bold\"> to</span> 2015-01-01T00:00:00Z<br>"
+ "<span class=\"bold\">Session visible from:</span> 2012-01-01T00:00:00Z<br>"
+ "<span class=\"bold\">Results visible from:</span> 1970-11-27T00:00:00Z<br><br>"
+ "<span class=\"bold\">Results visible from:</span> 1970-01-01T00:00:00Z<br><br>"
+ "<span class=\"bold\">Instructions:</span> "
+ "<Text: instructions>|||/page/instructorFeedbackEditSave";
AssertHelper.assertLogMessageEqualsInMasqueradeMode(expectedString, a.getLogMessage(), adminUserId);
Expand Down

0 comments on commit e32eeff

Please sign in to comment.