Revision: dbb1380498
Author: lucio.benfante <lucio dot benfante at gmail dot com>
Date: Wed Sep 23 22:30:10 2009
Log: Fixed assessment copy, adding the new attribute blankAnswerWeight.
http://code.google.com/p/minimark/source/detail?r=dbb1380498
Revision: fe70af2ff2
Author: lucio.benfante <lucio dot benfante at gmail dot com>
Date: Thu Sep 24 05:28:26 2009
Log: Fixed assessment template with assessmentDate and blankAnswerWeight....
http://code.google.com/p/minimark/source/detail?r=fe70af2ff2
==============================================================================
Revision: dbb1380498
Author: lucio.benfante <lucio dot benfante at gmail dot com>
Date: Wed Sep 23 22:30:10 2009
Log: Fixed assessment copy, adding the new attribute blankAnswerWeight.
http://code.google.com/p/minimark/source/detail?r=dbb1380498
Modified:
/minimark/src/main/java/com/benfante/minimark/blo/AssessmentBo.java
=======================================
--- /minimark/src/main/java/com/benfante/minimark/blo/AssessmentBo.java Fri
Sep 18 23:31:58 2009
+++ /minimark/src/main/java/com/benfante/minimark/blo/AssessmentBo.java Wed
Sep 23 22:30:10 2009
@@ -27,6 +27,7 @@
import com.benfante.minimark.po.AssessmentTemplate;
import com.benfante.minimark.po.Course;
import com.benfante.minimark.po.Question;
+import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
@@ -272,6 +273,7 @@
Assessment result = new Assessment();
result.setAllowStudentPrint(assessment.getAllowStudentPrint());
result.setAssessmentDate(new Date());
+ result.setBlankAnswerWeight(assessment.getBlankAnswerWeight());
result.setConfirmPassword(assessment.getPassword());
result.setCourse(assessment.getCourse());
result.setDescription(assessment.getDescription());
==============================================================================
Revision: fe70af2ff2
Author: lucio.benfante <lucio dot benfante at gmail dot com>
Date: Thu Sep 24 05:28:26 2009
Log: Fixed assessment template with assessmentDate and blankAnswerWeight.
Fixed assessment date on copy.
http://code.google.com/p/minimark/source/detail?r=fe70af2ff2
Modified:
/minimark/src/main/java/com/benfante/minimark/blo/AssessmentBo.java
/minimark/src/main/java/com/benfante/minimark/controllers/AssessmentTemplateController.java
/minimark/src/main/java/com/benfante/minimark/po/Assessment.java
/minimark/src/main/java/com/benfante/minimark/po/AssessmentTemplate.java
/minimark/src/main/webapp/WEB-INF/jsp/assessment/template/edit.jsp
=======================================
--- /minimark/src/main/java/com/benfante/minimark/blo/AssessmentBo.java Wed
Sep 23 22:30:10 2009
+++ /minimark/src/main/java/com/benfante/minimark/blo/AssessmentBo.java Thu
Sep 24 05:28:26 2009
@@ -27,7 +27,6 @@
import com.benfante.minimark.po.AssessmentTemplate;
import com.benfante.minimark.po.Course;
import com.benfante.minimark.po.Question;
-import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
@@ -194,7 +193,12 @@
public Assessment createFromTemplate(AssessmentTemplate template) {
Assessment result = new Assessment();
result.setCourse(template.getCourse());
- result.setAssessmentDate(new Date());
+ if (template.getAssessmentDate() == null) {
+ result.setAssessmentDate(new Date());
+ } else {
+ result.setAssessmentDate(template.getAssessmentDate());
+ }
+ result.setBlankAnswerWeight(template.getBlankAnswerWeight());
result.setDescription(template.getDescription());
result.setDuration(template.getDuration());
result.setEvaluationClosedMinimumEvaluation(template.
@@ -272,7 +276,8 @@
public Assessment copyAssessment(Assessment assessment, Locale locale)
{
Assessment result = new Assessment();
result.setAllowStudentPrint(assessment.getAllowStudentPrint());
- result.setAssessmentDate(new Date());
+ result.setAssessmentDate(assessment.getAssessmentDate());
+ result.updateAssessmentDate();
result.setBlankAnswerWeight(assessment.getBlankAnswerWeight());
result.setConfirmPassword(assessment.getPassword());
result.setCourse(assessment.getCourse());
=======================================
---
/minimark/src/main/java/com/benfante/minimark/controllers/AssessmentTemplateController.java
Fri Sep 4 00:37:53 2009
+++
/minimark/src/main/java/com/benfante/minimark/controllers/AssessmentTemplateController.java
Thu Sep 24 05:28:26 2009
@@ -94,6 +94,7 @@
} else {
template = templates.get(0);
}
+ template.updateAssessmentDate();
template.buildQuestionRequests();
model.addAttribute(ASSESSMENT_TEMPLATE_ATTR_NAME, template);
return EDIT_VIEW;
=======================================
--- /minimark/src/main/java/com/benfante/minimark/po/Assessment.java Wed
Sep 23 21:57:51 2009
+++ /minimark/src/main/java/com/benfante/minimark/po/Assessment.java Thu
Sep 24 05:28:26 2009
@@ -387,4 +387,13 @@
}
return result;
}
-}
+
+ public void updateAssessmentDate() {
+ final Date today = new Date();
+ if (this.getAssessmentDate() == null ||
this.getAssessmentDate().before(
+ today)) {
+ this.setAssessmentDate(today);
+ }
+ }
+
+}
=======================================
---
/minimark/src/main/java/com/benfante/minimark/po/AssessmentTemplate.java
Fri Sep 4 00:37:53 2009
+++
/minimark/src/main/java/com/benfante/minimark/po/AssessmentTemplate.java
Thu Sep 24 05:28:26 2009
@@ -20,6 +20,7 @@
import com.benfante.minimark.beans.QuestionRequest;
import java.math.BigDecimal;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -27,6 +28,8 @@
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
import javax.persistence.Transient;
import org.apache.commons.lang.StringUtils;
import org.parancoe.persistence.po.hibernate.EntityBase;
@@ -59,6 +62,7 @@
@NotNull(applyIf = "evaluationType == 'normalized_sum'")
protected BigDecimal evaluationMaxValue;
protected BigDecimal evaluationClosedMinimumEvaluation =
BigDecimal.ZERO;
+ protected BigDecimal blankAnswerWeight;
@Min(value = 0.0)
protected Long duration = Long.valueOf(0);
protected Boolean allowStudentPrint = Boolean.FALSE;
@@ -68,6 +72,7 @@
protected BigDecimal minPassedValue;
protected String tagSelectors;
protected Boolean shuffleQuestions = Boolean.FALSE;
+ protected Date assessmentDate;
@ManyToOne
public Course getCourse() {
@@ -77,6 +82,14 @@
public void setCourse(Course course) {
this.course = course;
}
+
+ public BigDecimal getBlankAnswerWeight() {
+ return blankAnswerWeight;
+ }
+
+ public void setBlankAnswerWeight(BigDecimal blankAnswerWeight) {
+ this.blankAnswerWeight = blankAnswerWeight;
+ }
@Column(length = 1024)
public String getDescription() {
@@ -188,6 +201,15 @@
public void setQuestionRequests(List<QuestionRequest>
questionRequests) {
this.questionRequests = questionRequests;
}
+
+ @Temporal(TemporalType.DATE)
+ public Date getAssessmentDate() {
+ return assessmentDate;
+ }
+
+ public void setAssessmentDate(Date assessmentDate) {
+ this.assessmentDate = assessmentDate;
+ }
public void buildQuestionRequests() {
int dim = Math.max(10, questionRequests.size());
@@ -225,4 +247,12 @@
}
tagSelectors = sb.toString();
}
-}
+
+ public void updateAssessmentDate() {
+ final Date today = new Date();
+ if (this.getAssessmentDate() == null ||
this.getAssessmentDate().before(
+ today)) {
+ this.setAssessmentDate(today);
+ }
+ }
+}
=======================================
--- /minimark/src/main/webapp/WEB-INF/jsp/assessment/template/edit.jsp Fri
Sep 4 00:37:53 2009
+++ /minimark/src/main/webapp/WEB-INF/jsp/assessment/template/edit.jsp Thu
Sep 24 05:28:26 2009
@@ -30,6 +30,8 @@
<form:label path="title"><spring:message code="Title"
text="?Title?"/>:</form:label><form:input path="title" maxlength="255"
cssClass="full-size" cssErrorClass="fieldInError full-size"/> *<br/>
<form:errors path="description" cssClass="errorBox"/>
<form:label path="description"><spring:message code="Description"
text="?Description?"/>:</form:label><form:textarea path="description"
cols="25" rows="5" cssErrorClass="fieldInError"/> *<br/>
+ <form:errors path="assessmentDate" cssClass="errorBox"/>
+ <form:label path="assessmentDate"><spring:message code="Date"
text="?Date?"/>:</form:label><form:input path="assessmentDate"
maxlength="10" size="10" cssErrorClass="fieldInError full-size"/><img
id="assessmentDateCalendar" src="${cp}/images/silk/icons/calendar.png"
alt="Calendar icon" class="calendar-icon"/> <span
class="form-help-text">(dd/MM/yyyy)</span> *<br/>
<form:errors path="duration" cssClass="errorBox"/>
<form:label path="duration"><spring:message code="Duration"
text="?Duration?"/>:</form:label><form:input path="duration"
maxlength="255" cssClass="full-size" cssErrorClass="fieldInError
full-size"/><br/>
<div class="form-aligned form-help-text"><span><spring:message
code="help.durationField" text="?help.durationField?"/></span></div>
@@ -55,12 +57,14 @@
<form:label path="evaluationClosedType"><spring:message
code="EvaluationClosedType" text="?EvaluationClosedType?"/>:</form:label>
<form:select path="evaluationClosedType">
<spring:message code="ETCSumCorrectMinusWrongAnswers"
text="?ETCSumCorrectMinusWrongAnswers?"
var="ETCSumCorrectMinusWrongAnswersLabel"/>
- <form:option value="sum_correct_answers"
label="${ETCSumCorrectMinusWrongAnswersLabel}"/>
+ <form:option value="sum_correct_minus_wrong_answers"
label="${ETCSumCorrectMinusWrongAnswersLabel}"/>
<spring:message code="ETCSumCorrectAnswers"
text="?ETCSumCorrectAnswers?" var="ETCSumCorrectAnswersLabel"/>
<form:option value="sum_correct_answers"
label="${ETCSumCorrectAnswersLabel}"/>
</form:select><br/>
<form:errors path="evaluationClosedMinimumEvaluation"
cssClass="errorBox"/>
<form:label path="evaluationClosedMinimumEvaluation"><spring:message
code="EvaluationClosedMinimumEvaluation"
text="?EvaluationClosedMinimumEvaluation?"/>:</form:label><form:input
path="evaluationClosedMinimumEvaluation" maxlength="255"
cssClass="full-size" cssErrorClass="fieldInError full-size"/><br/>
+ <form:errors path="blankAnswerWeight" cssClass="errorBox"/>
+ <form:label path="blankAnswerWeight"><spring:message
code="BlankAnswerWeight"
text="?BlankAnswerWeight?"/>:</form:label><form:input
path="blankAnswerWeight" maxlength="255" cssClass="full-size"
cssErrorClass="fieldInError full-size"/><br/>
<form:errors path="allowStudentPrint" cssClass="errorBox"/>
<form:label path="allowStudentPrint"><spring:message
code="StudentPrint" text="?StudentPrint?"/>:</form:label>
<form:select path="allowStudentPrint">
@@ -97,6 +101,7 @@
</form:form>
<script type="text/javascript">
+ attachCalendar('assessmentDateCalendar', 'assessmentDate', false);
new Field.Observer('evaluationType', 0.5, showETFields);
new Field.Observer('exposedResult', 0.5, showERFields);