Skip to content
Snippets Groups Projects
Commit 84b2a73e authored by srosse's avatar srosse
Browse files

OPENOLAT-199: readd some code from previous version, format, fix typo in velocity template

parent 62069379
No related branches found
No related tags found
No related merge requests found
......@@ -214,6 +214,12 @@ public class OnyxRunController extends BasicController {
if (viewmode != SURVEYVIEW) {
ScoreEvaluation se = null;
//<OLATCE-1232>
boolean isVisibilityPeriod = AssessmentHelper.isResultVisible(modConfig);
vc.contextPut("showResultsVisible", new Boolean(isVisibilityPeriod));
//</OLATCE-1232>
if (courseNodeTest != null) {
// <OLATCE-498>
Integer attempts = courseNodeTest.getUserAttempts(userCourseEnv);
......@@ -271,7 +277,7 @@ public class OnyxRunController extends BasicController {
if (hasResult) {
vc.contextPut("hasResult", Boolean.TRUE);
boolean isPassesSet = se.getPassed() != null;
vc.contextPut(IQEditController.CONFIG_KEY_RESULT_ON_HOME_PAGE, modConfig.get(IQEditController.CONFIG_KEY_RESULT_ON_HOME_PAGE));
vc.contextPut("showResultsOnHomePage", modConfig.get(IQEditController.CONFIG_KEY_RESULT_ON_HOME_PAGE));
if (isPassesSet) {
vc.contextPut("passed", se.getPassed());
} else {
......
##
<h3>$!menuTitle</h3>
<i>$!displayTitle</i>
......@@ -24,38 +23,26 @@
#end
</td>
</tr>
<tr>
#if ($attampts)
<td>
$r.translate("attempts.yourattempts"):
</td>
<td>
$attempts
</td>
#end
#if($attempts)
<tr>
<td>$r.translate("attempts.yourattempts"):</td>
<td>$attempts</td>
</tr>
#end
#if ($attempts && $attempts >0 || $self)
<tr>
<td colspan="2"><b>$r.translate("attempts.result")</b></td>
</tr>
#foreach ($var in $qtivars)
<tr>
<td>
${var.getIdentifier()}:
</td>
<td>
${var.getValue()}
</td>
<td>${var.getIdentifier()}:</td>
<td>${var.getValue()}</td>
</tr>
#end
#if ($hasResult == true)
<tr>
<td>
$r.translate("score.yourscore"):
</td>
<td>
$score
</td>
#end
#if ($hasResult == true)
<tr>
<td>$r.translate("score.yourscore"):</td>
<td>$score</td>
</tr>
##<OLATCE-1014> hide status - line if there is no passed value set
#if($passed != "")
......@@ -73,13 +60,11 @@
##<OLATCE-1014>
#end
##</OLATCE-1014>
#else
#else
<tr>
<td>
$r.translate("no.testresults")
</td>
<td colspan="2">$r.translate("no.testresults")</td>
</tr>
#end
#end
<tr>
<td>
#if($showResultsOnHomePage && $attempts && $attempts >0)
......
......@@ -436,17 +436,16 @@ public class AssessmentHelper {
public static boolean isResultVisible(ModuleConfiguration modConfig) {
boolean isVisible = false;
Boolean showResultsActive = (Boolean)modConfig.get(IQEditController.CONFIG_KEY_DATE_DEPENDENT_RESULTS);
if(showResultsActive!=null && showResultsActive.booleanValue()) {
Date startDate = (Date)modConfig.get(IQEditController.CONFIG_KEY_RESULTS_START_DATE);
Date endDate = (Date)modConfig.get(IQEditController.CONFIG_KEY_RESULTS_END_DATE);
Date currentDate = new Date();
if(currentDate.after(startDate) && (endDate==null || currentDate.before(endDate))) {
isVisible = true;
}
if(showResultsActive != null && showResultsActive.booleanValue()) {
Date startDate = (Date)modConfig.get(IQEditController.CONFIG_KEY_RESULTS_START_DATE);
Date endDate = (Date)modConfig.get(IQEditController.CONFIG_KEY_RESULTS_END_DATE);
Date currentDate = new Date();
if(startDate != null && currentDate.after(startDate) && (endDate == null || currentDate.before(endDate))) {
isVisible = true;
}
} else {
isVisible = true;
}
return isVisible;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment