Skip to content

Commit

Permalink
SAM-2751 Samigo honor pledge setting not being persisted (sakaiprojec…
Browse files Browse the repository at this point in the history
  • Loading branch information
ern committed May 9, 2016
1 parent 3928169 commit 8d74c7f
Show file tree
Hide file tree
Showing 25 changed files with 100 additions and 36 deletions.
9 changes: 9 additions & 0 deletions reference/docs/conversion/sakai_11_mysql_conversion.sql
Original file line number Diff line number Diff line change
Expand Up @@ -912,3 +912,12 @@ INSERT INTO SAM_ASSESSMETADATA_T (ASSESSMENTMETADATAID, ASSESSMENTID, LABEL, ENT
AND TYPEID='142' AND ISTEMPLATE=1),
'instructorNotification_isInstructorEditable', 'true');
--END SAM-2709

-- SAM-2751
ALTER TABLE SAM_ASSESSACCESSCONTROL_T ADD HONORPLEDGE BIT;
ALTER TABLE SAM_PUBLISHEDACCESSCONTROL_T ADD HONORPLEDGE BIT;
INSERT INTO SAM_ASSESSMETADATA_T (ASSESSMENTID, LABEL, ENTRY)
SELECT DISTINCT ASSESSMENTID, 'honorpledge_isInstructorEditable' as LABEL, 'true' as ENTRY
FROM SAM_ASSESSMETADATA_T WHERE ASSESSMENTID NOT IN
(SELECT DISTINCT ASSESSMENTID FROM SAM_ASSESSMETADATA_T WHERE LABEL = 'honorpledge_isInstructorEditable');
-- END SAM-2751
9 changes: 9 additions & 0 deletions reference/docs/conversion/sakai_11_oracle_conversion.sql
Original file line number Diff line number Diff line change
Expand Up @@ -995,3 +995,12 @@ INSERT INTO SAM_ASSESSMETADATA_T (ASSESSMENTMETADATAID, ASSESSMENTID, LABEL, ENT
-- SAK-29442 Sequence LB_PEER_EVAL_RESULT_S Missing
CREATE SEQUENCE LB_PEER_EVAL_RESULT_S;
-- END SAK-29442

-- SAM-2751
ALTER TABLE SAM_ASSESSACCESSCONTROL_T ADD HONORPLEDGE NUMBER(1,0);
ALTER TABLE SAM_PUBLISHEDACCESSCONTROL_T ADD HONORPLEDGE NUMBER(1,0);
INSERT INTO SAM_ASSESSMETADATA_T (ASSESSMENTID, LABEL, ENTRY)
SELECT DISTINCT ASSESSMENTID, 'honorpledge_isInstructorEditable' as LABEL, 'true' as ENTRY
FROM SAM_ASSESSMETADATA_T WHERE ASSESSMENTID NOT IN
(SELECT DISTINCT ASSESSMENTID FROM SAM_ASSESSMETADATA_T WHERE LABEL = 'honorpledge_isInstructorEditable');
-- END SAM-2751
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,8 @@ public interface AssessmentAccessControlIfc

void setMarkForReview(Integer markForReview);

Boolean getHonorPledge();

void setHonorPledge(Boolean honorPledge);

}
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ public void fillComponents(UIContainer tofill, ViewParameters viewparams,

delivery.setAssessmentId(pub.getPublishedAssessmentId().toString());
delivery.setAssessmentTitle(pub.getTitle());
delivery.setHonorPledge(pub.getAssessmentMetaDataByLabel("honorpledge_isInstructorEditable") != null &&
pub.getAssessmentMetaDataByLabel("honorpledge_isInstructorEditable").toLowerCase().equals("true"));
delivery.setHonorPledge(pub.getAssessmentAccessControl().getHonorPledge());
delivery.setPublishedAssessment(pub);

String path = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public class AssessmentSettingsBean
private String originalFeedbackDateString;

private boolean isMarkForReview;

private boolean honorPledge;
private String releaseToGroupsAsString;
private String blockDivs;

Expand Down Expand Up @@ -335,7 +335,8 @@ public void setAssessment(AssessmentFacade assessment) {
this.submissionsSaved = accessControl.getSubmissionsSaved().toString();

this.isMarkForReview = accessControl.getMarkForReview() != null && (Integer.valueOf(1)).equals(accessControl.getMarkForReview());

if (accessControl.getHonorPledge() != null)
this.honorPledge = accessControl.getHonorPledge();
// default to unlimited if control value is null
if (accessControl.getUnlimitedSubmissions()!=null && !accessControl.getUnlimitedSubmissions()){
this.unlimitedSubmissions=AssessmentAccessControlIfc.LIMITED_SUBMISSIONS.toString();
Expand Down Expand Up @@ -929,8 +930,11 @@ public void setScoringType(String scoringType) {
this.scoringType = scoringType;
}

public boolean isHonorPledge() { return honorPledge; }

public void setHonorPledge(boolean honorPledge) { this.honorPledge = honorPledge; }

public void setValue(String key, Object value){
public void setValue(String key, Object value){
this.values.put(key, value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ public class PublishedAssessmentSettingsBean
private boolean updateMostCurrentSubmission = false;

private boolean isMarkForReview;
private boolean honorPledge;
private List attachmentList;
private boolean editPubAnonyGradingRestricted = false;
private String releaseToGroupsAsString;
Expand Down Expand Up @@ -303,7 +304,8 @@ public void setAssessment(PublishedAssessmentFacade assessment) {
this.submissionsSaved = accessControl.getSubmissionsSaved().toString();

this.isMarkForReview = accessControl.getMarkForReview() != null && (Integer.valueOf(1)).equals(accessControl.getMarkForReview());

if (accessControl.getHonorPledge() != null)
this.honorPledge = accessControl.getHonorPledge();
// default to unlimited if control value is null
if (accessControl.getUnlimitedSubmissions()!=null && !accessControl.getUnlimitedSubmissions()){
this.unlimitedSubmissions=AssessmentAccessControlIfc.LIMITED_SUBMISSIONS.toString();
Expand Down Expand Up @@ -884,6 +886,10 @@ public void setSecureDeliveryAvailable(boolean secureDeliveryAvailable) {
this.secureDeliveryAvailable = secureDeliveryAvailable;
}

public boolean isHonorPledge() { return honorPledge; }

public void setHonorPledge(boolean honorPledge) { this.honorPledge = honorPledge; }

public void setValue(String key, Object value){
this.values.put(key, value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.Date;
import java.util.HashMap;

import com.sun.org.apache.xpath.internal.operations.Bool;
import org.sakaiproject.samigo.util.SamigoConstants;
import org.sakaiproject.tool.assessment.api.SamigoApiFactory;
import org.sakaiproject.tool.assessment.business.entity.RecordingData;
Expand All @@ -57,6 +58,7 @@ public class TemplateBean implements Serializable
private String questionNumbering = "1";
private String displayScoreDuringAssessments = "1";
private Boolean markForReview = Boolean.TRUE;
private boolean honorPledge;
private String submissionModel = "1";
private String submissionNumber;
private String lateHandling = "2";
Expand Down Expand Up @@ -106,6 +108,7 @@ public TemplateBean()
values.put("anonymousRelease_isInstructorEditable", Boolean.TRUE);
values.put("authenticatedRelease_isInstructorEditable", Boolean.TRUE);
values.put("instructorNotification_isInstructorEditable", Boolean.TRUE);
values.put("honorpledge_isInstructorEditable", Boolean.TRUE);
}

public void setOutcome(String outcome){
Expand Down Expand Up @@ -446,6 +449,10 @@ public Boolean getMarkForReview()
return markForReview;
}

public boolean isHonorPledge() { return honorPledge; }

public void setHonorPledge(boolean honorPledge) { this.honorPledge = honorPledge; }

/**
* submission model
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public class DeliveryBean

private String assessmentId;
private String assessmentTitle;
private Boolean honorPledge = Boolean.FALSE;
private boolean honorPledge;
private ArrayList markedForReview;
private ArrayList blankItems;
private ArrayList markedForReviewIdents;
Expand Down Expand Up @@ -3959,11 +3959,11 @@ public void setRedrawAnchorName(String redrawAnchorName)
this.redrawAnchorName = redrawAnchorName;
}

public Boolean getHonorPledge() {
public boolean isHonorPledge() {
return honorPledge;
}

public void setHonorPledge(Boolean honorPledge) {
public void setHonorPledge(boolean honorPledge) {
this.honorPledge = honorPledge;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ public AssessmentFacade save(AssessmentSettingsBean assessmentSettings, boolean
control.setMarkForReview(AssessmentAccessControl.NOT_MARK_FOR_REVIEW);
}

control.setHonorPledge(assessmentSettings.isHonorPledge());

// d. set Submissions
if (assessmentSettings.getUnlimitedSubmissions()!=null){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ else if (assessmentSettings.getRetractDate() == null
control.setMarkForReview(AssessmentAccessControl.NOT_MARK_FOR_REVIEW);
}

control.setHonorPledge(assessmentSettings.isHonorPledge());

// set Submissions
if (assessmentSettings.getUnlimitedSubmissions()!=null){
if (!assessmentSettings.getUnlimitedSubmissions().
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ public boolean loadAssessment(TemplateBean templateBean, String templateId)
templateBean.setQuestionNumbering(aac.getItemNumbering().toString());
if (aac.getDisplayScoreDuringAssessments() != null)
templateBean.setDisplayScoreDuringAssessments(aac.getDisplayScoreDuringAssessments().toString());
if (aac.getHonorPledge() != null)
templateBean.setHonorPledge(aac.getHonorPledge());

if (aac.getMarkForReview() != null) {
if (aac.getMarkForReview().equals(Integer.valueOf(1))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public boolean updateAssessment(TemplateBean templateBean)
aac.setAssessmentFormat(Integer.valueOf(templateBean.getDisplayChunking()));
aac.setItemNumbering(Integer.valueOf(templateBean.getQuestionNumbering()));
aac.setDisplayScoreDuringAssessments(Integer.valueOf(templateBean.getDisplayScoreDuringAssessments()));

aac.setHonorPledge(templateBean.isHonorPledge());
if (templateBean.getMarkForReview() != null && templateBean.getMarkForReview().equals(Boolean.TRUE)) {
aac.setMarkForReview(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ else if (DeliveryBean.REVIEW_ASSESSMENT == action || DeliveryBean.TAKE_ASSESSMEN
// set the outcome to isRetractedForEdit2 error page.
if (DeliveryBean.REVIEW_ASSESSMENT == action && AssessmentIfc.RETRACT_FOR_EDIT_STATUS.equals(pub.getStatus())) {
delivery.setAssessmentTitle(pub.getTitle());
delivery.setHonorPledge(pub.getAssessmentMetaDataByLabel("honorpledge_isInstructorEditable") != null &&
pub.getAssessmentMetaDataByLabel("honorpledge_isInstructorEditable").toLowerCase().equals("true"));
delivery.setHonorPledge(control.getHonorPledge());
delivery.setOutcome("isRetractedForEdit2");
return;
}
Expand Down Expand Up @@ -316,8 +315,6 @@ private void populateDelivery(DeliveryBean delivery, PublishedAssessmentIfc pubA
// #0 - global information
delivery.setAssessmentId((pubAssessment.getPublishedAssessmentId()).toString());
delivery.setAssessmentTitle(pubAssessment.getTitle());
delivery.setHonorPledge(pubAssessment.getAssessmentMetaDataByLabel("honorpledge_isInstructorEditable") != null &&
pubAssessment.getAssessmentMetaDataByLabel("honorpledge_isInstructorEditable").toLowerCase().equals("true"));
String instructorMessage = pubAssessment.getDescription();
delivery.setInstructorMessage(instructorMessage);

Expand Down Expand Up @@ -352,6 +349,7 @@ private void populateDelivery(DeliveryBean delivery, PublishedAssessmentIfc pubA
else {
delivery.setDisplayMardForReview(false);
}
if (control.getHonorPledge() != null) delivery.setHonorPledge(control.getHonorPledge());

// #1 - set submission remains
populateSubmissionsRemaining(service, pubAssessment, delivery);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ public void doPost(HttpServletRequest req, HttpServletResponse res)
}
delivery.setAssessmentId(pub.getPublishedAssessmentId().toString());
delivery.setAssessmentTitle(pub.getTitle());
delivery.setHonorPledge(pub.getAssessmentMetaDataByLabel("honorpledge_isInstructorEditable") != null &&
pub.getAssessmentMetaDataByLabel("honorpledge_isInstructorEditable").toLowerCase().equals("true"));
delivery.setHonorPledge(pub.getAssessmentAccessControl().getHonorPledge());
delivery.setPublishedAssessment(pub);

BeginDeliveryActionListener listener = new BeginDeliveryActionListener();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ private void populateBeanFromPub(DeliveryBean delivery,
log.info("** 4. FakeBeginDeliveryActionListener, pubId= "+pubAssessment.getPublishedAssessmentId());
delivery.setAssessmentId((pubAssessment.getPublishedAssessmentId()).toString());
delivery.setAssessmentTitle(pubAssessment.getTitle());
delivery.setHonorPledge(pubAssessment.getAssessmentMetaDataByLabel("honorpledge_isInstructorEditable") != null &&
pubAssessment.getAssessmentMetaDataByLabel("honorpledge_isInstructorEditable").toLowerCase().equals("true"));
delivery.setHonorPledge(pubAssessment.getAssessmentAccessControl().getHonorPledge());
delivery.setInstructorMessage(pubAssessment.getDescription());
delivery.setCreatorName(pubAssessment.getCreatedBy());
delivery.setSubmitted(false);
Expand Down
7 changes: 3 additions & 4 deletions samigo/samigo-app/src/webapp/jsf/author/authorSettings.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,10 @@

<!-- Honor Pledge -->
<div class="form-group row">
<h:outputLabel styleClass="col-md-2" for="honor_pledge" value="#{assessmentSettingsMessages.honor_pledge}" />
<h:outputLabel styleClass="col-md-2" for="honor_pledge" value="#{assessmentSettingsMessages.honor_pledge}" rendered="#{assessmentSettings.valueMap.honorpledge_isInstructorEditable==true}"/>
<div class="col-md-10">
<h:selectBooleanCheckbox id="honor_pledge" value="#{assessmentSettings.valueMap.honorpledge_isInstructorEditable}"/>
<h:outputText value="&#160;" escape="false" />
<h:outputText value="#{assessmentSettingsMessages.honor_pledge_add}" />
<h:selectBooleanCheckbox id="honor_pledge" value="#{assessmentSettings.honorPledge}" rendered="#{assessmentSettings.valueMap.honorpledge_isInstructorEditable==true}"/>
<h:outputText value="#{assessmentSettingsMessages.honor_pledge_add}" rendered="#{assessmentSettings.valueMap.honorpledge_isInstructorEditable==true}"/>
</div>
</div>

Expand Down
6 changes: 3 additions & 3 deletions samigo/samigo-app/src/webapp/jsf/author/publishedSettings.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@

<!-- Honor Pledge -->
<div class="form-group row">
<h:outputLabel styleClass="col-md-2" value="#{assessmentSettingsMessages.honor_pledge}"/>
<h:outputLabel styleClass="col-md-2" value="#{assessmentSettingsMessages.honor_pledge}" rendered="#{publishedSettings.valueMap.honorpledge_isInstructorEditable==true}"/>
<div class="col-md-10">
<h:selectBooleanCheckbox id="honor_pledge" value="#{publishedSettings.valueMap.honorpledge_isInstructorEditable}"/>
<h:outputText value="#{assessmentSettingsMessages.honor_pledge_add}"/>
<h:selectBooleanCheckbox id="honor_pledge" value="#{publishedSettings.honorPledge}" rendered="#{publishedSettings.valueMap.honorpledge_isInstructorEditable==true}"/>
<h:outputText value="#{assessmentSettingsMessages.honor_pledge_add}" rendered="#{publishedSettings.valueMap.honorpledge_isInstructorEditable==true}"/>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@

<h:panelGroup layout="block" styleClass="honor-container" rendered="#{delivery.honorPledge && delivery.firstTimeTaking}">
<h:selectBooleanCheckbox id="honor_pledge" />
<h:outputText value="&#160;" escape="false" />
<h:outputLabel for="honor_pledge" value="#{deliveryMessages.honor_pledge_detail}"/>
<h:outputText id="honorPledgeRequired" value="#{deliveryMessages.honor_required}" styleClass="alertMessage" style="display:none"/>
</h:panelGroup>
Expand Down
22 changes: 15 additions & 7 deletions samigo/samigo-app/src/webapp/jsf/template/templateEditor.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,23 @@

<h:outputText value=""/>
<h:outputText value=""/>
<!-- Honor Pledge -->
<h:outputLabel value="#{templateMessages.honor_pledge}"/>
</h:panelGrid>
<h:panelGrid columns="1">
<!-- Honor Pledge -->
<h:panelGroup>
<h:selectBooleanCheckbox id="honor_pledge" value="#{template.valueMap.honorpledge_isInstructorEditable}"/>
<h:outputLabel for="honor_pledge" value="#{templateMessages.honor_pledge_add}"/>
</h:panelGroup>
</div>

<h:outputText value="#{templateMessages.honor_pledge}"/>
</h:panelGroup>
<h:panelGroup>
<h:selectBooleanCheckbox id="honor_pledge_can_edit" value="#{template.valueMap.honorpledge_isInstructorEditable}"/>
<h:outputLabel for="honor_pledge_can_edit" value="#{templateMessages.template_canbedefault}"/>
</h:panelGroup>
<h:panelGroup>
<h:selectBooleanCheckbox id="honor_pledge" value="#{template.honorPledge}"/>
<h:outputLabel for="honor_pledge" value="#{templateMessages.honor_pledge_add}"/>
</h:panelGroup>
</h:panelGrid>
</div>

</div></div>
</samigo:hideDivision>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public class AssessmentAccessControl
private String releaseTo;
private String password;
private Integer markForReview;
private Boolean honorPledge;

/**
* Creates a new SubmissionModel object.
Expand Down Expand Up @@ -171,6 +172,7 @@ public Object clone() throws CloneNotSupportedException{
((AssessmentAccessControl)cloned).setFinalPageUrl(this.finalPageUrl);
((AssessmentAccessControl)cloned).setUnlimitedSubmissions(this.unlimitedSubmissions);
((AssessmentAccessControl)cloned).setMarkForReview(this.markForReview);
((AssessmentAccessControl)cloned).setHonorPledge(this.honorPledge);
return cloned;
}

Expand Down Expand Up @@ -417,5 +419,11 @@ public Integer getMarkForReview() {
public void setMarkForReview(Integer markForReview) {
this.markForReview = markForReview;
}


@Override
public Boolean getHonorPledge() { return this.honorPledge; }

@Override
public void setHonorPledge(Boolean honorPledge) { this.honorPledge = honorPledge; }

}
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
<property name="password" type="string" length="255" column="PASSWORD" not-null="false" />
<property name="finalPageUrl" type="string" length="1023" column="FINALPAGEURL" not-null="false" />
<property name="markForReview" type="integer" column="MARKFORREVIEW" not-null="false" />

<property name="honorPledge" type="boolean" column="HONORPLEDGE" not-null="false" />
<!--
<property name="unlimitedSubmissions">
<column name="UNLIMITEDSUBMISSIONS" not-null="false" sql-type="integer" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public class PublishedAccessControl
private String password;
private Boolean unlimitedSubmissions;
private Integer markForReview;
private Boolean honorPledge;

/**
* Creates a new SubmissionModel object.
Expand Down Expand Up @@ -144,6 +145,7 @@ public Object clone() throws CloneNotSupportedException{
((PublishedAccessControl)cloned).setPassword(this.password);
((PublishedAccessControl)cloned).setFinalPageUrl(this.finalPageUrl);
((PublishedAccessControl)cloned).setUnlimitedSubmissions(this.unlimitedSubmissions);
((PublishedAccessControl)cloned).setHonorPledge(this.honorPledge);
return cloned;
}

Expand Down Expand Up @@ -396,5 +398,11 @@ public Integer getMarkForReview() {
public void setMarkForReview(Integer markForReview) {
this.markForReview = markForReview;
}


@Override
public Boolean getHonorPledge() { return this.honorPledge; }

@Override
public void setHonorPledge(Boolean honorPledge) { this.honorPledge = honorPledge; }

}
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
<property name="password" type="string" length="255" column="PASSWORD" not-null="false" />
<property name="finalPageUrl" type="string" length="1023" column="FINALPAGEURL" not-null="false" />
<property name="markForReview" type="integer" column="MARKFORREVIEW" not-null="false" />
<property name="honorPledge" type="boolean" column="HONORPLEDGE" not-null="false" />
</class>

<class name="org.sakaiproject.tool.assessment.data.dao.assessment.PublishedEvaluationModel"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2122,6 +2122,7 @@ public AssessmentAccessControl prepareAssessmentAccessControl(
newAccessControl.setUnlimitedSubmissions(a.getUnlimitedSubmissions());
newAccessControl.setAssessmentBase(p);
newAccessControl.setMarkForReview(a.getMarkForReview());
newAccessControl.setHonorPledge(a.getHonorPledge());
return newAccessControl;
}

Expand Down
Loading

0 comments on commit 8d74c7f

Please sign in to comment.