Skip to content
Snippets Groups Projects
Commit 07ebcaf7 authored by srosse's avatar srosse
Browse files

OO-1593: upgrade the status of the assessed identities of the different course element

parent f1255e8c
No related branches found
No related tags found
No related merge requests found
Showing
with 598 additions and 83 deletions
...@@ -162,16 +162,19 @@ public class AssessmentToolManagerImpl implements AssessmentToolManager { ...@@ -162,16 +162,19 @@ public class AssessmentToolManagerImpl implements AssessmentToolManager {
stats.setParameter("identityKey", coach.getKey()); stats.setParameter("identityKey", coach.getKey());
} }
Object[] result = stats.getSingleResult(); List<Object[]> results = stats.getResultList();
Double averageScore = (Double)result[0]; if(results != null && results.size() > 0) {
Long numOfPassed = (Long)result[1]; Object[] result = results.get(0);
Long numOfFailed = (Long)result[2]; Double averageScore = (Double)result[0];
Long numOfNotAttempted = (Long)result[3]; Long numOfPassed = (Long)result[1];
Long numOfFailed = (Long)result[2];
entry.setAverageScore(averageScore); Long numOfNotAttempted = (Long)result[3];
entry.setCountPassed(numOfPassed == null ? 0 : numOfPassed.intValue());
entry.setCountFailed(numOfFailed == null ? 0 : numOfFailed.intValue()); entry.setAverageScore(averageScore);
entry.setCountNotAttempted(numOfNotAttempted == null ? 0 : numOfNotAttempted.intValue()); entry.setCountPassed(numOfPassed == null ? 0 : numOfPassed.intValue());
entry.setCountFailed(numOfFailed == null ? 0 : numOfFailed.intValue());
entry.setCountNotAttempted(numOfNotAttempted == null ? 0 : numOfNotAttempted.intValue());
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("", e); log.error("", e);
......
...@@ -161,9 +161,9 @@ public class AssessmentIdentitiesCourseNodeController extends FormBasicControlle ...@@ -161,9 +161,9 @@ public class AssessmentIdentitiesCourseNodeController extends FormBasicControlle
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.attempts, "select")); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.attempts, "select"));
} }
if(assessableNode.hasScoreConfigured()) { if(assessableNode.hasScoreConfigured()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.min, "select")); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.min, "select", new ScoreCellRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.max, "select")); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.max, "select", new ScoreCellRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.score, "select")); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.score, "select", new ScoreCellRenderer()));
} }
if(assessableNode.hasPassedConfigured()) { if(assessableNode.hasPassedConfigured()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.passed, new PassedCellRenderer())); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.passed, new PassedCellRenderer()));
......
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.assessment.ui.tool;
import java.math.BigDecimal;
import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiCellRenderer;
import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableComponent;
import org.olat.core.gui.render.Renderer;
import org.olat.core.gui.render.StringOutput;
import org.olat.core.gui.render.URLBuilder;
import org.olat.core.gui.translator.Translator;
import org.olat.course.assessment.AssessmentHelper;
/**
* Format float and big decimal to the standard score format.
*
* Initial date: 03.12.2015<br>
* @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
*
*/
public class ScoreCellRenderer implements FlexiCellRenderer {
@Override
public void render(Renderer renderer, StringOutput target, Object cellValue,
int row, FlexiTableComponent source, URLBuilder ubu, Translator translator) {
if(cellValue instanceof Float) {
target.append(AssessmentHelper.getRoundedScore((Float)cellValue));
} else if(cellValue instanceof BigDecimal) {
target.append(AssessmentHelper.getRoundedScore((BigDecimal)cellValue));
}
}
}
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
</tr> </tr>
<tr> <tr>
<th>$r.translate("table.header.scoreAverage")</th> <th>$r.translate("table.header.scoreAverage")</th>
<td>$scoreAverage</td> <td>#if($scoreAverage && !$scoreAverage.isEmpty())$scoreAverage#end</td>
</tr> </tr>
<tr> <tr>
<th>$r.translate("table.header.numOfPassed")</th> <th>$r.translate("table.header.numOfPassed")</th>
......
...@@ -740,34 +740,9 @@ public class GTACourseNode extends AbstractAccessableCourseNode implements Persi ...@@ -740,34 +740,9 @@ public class GTACourseNode extends AbstractAccessableCourseNode implements Persi
@Override @Override
public String getDetailsListView(UserCourseEnvironment userCourseEnvironment) { public String getDetailsListView(UserCourseEnvironment userCourseEnvironment) {
String details; Identity assessedIdentity = userCourseEnvironment.getIdentityEnvironment().getIdentity();
if(getModuleConfiguration().getBooleanSafe(GTASK_ASSIGNMENT)) { RepositoryEntry entry = userCourseEnvironment.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
GTAManager gtaManager = CoreSpringFactory.getImpl(GTAManager.class); return CoreSpringFactory.getImpl(GTAManager.class).getDetails(assessedIdentity, entry, this);
Identity assessedIdentity = userCourseEnvironment.getIdentityEnvironment().getIdentity();
RepositoryEntry entry = userCourseEnvironment.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
List<Task> tasks = gtaManager.getTasks(assessedIdentity, entry, this);
if(tasks == null || tasks.isEmpty()) {
details = null;
} else {
StringBuilder sb = new StringBuilder();
for(Task task:tasks) {
if(sb.length() > 0) sb.append(", ");
if(sb.length() > 64) {
sb.append("...");
break;
}
String taskName = task.getTaskName();
if(StringHelper.containsNonWhitespace(taskName)) {
sb.append(StringHelper.escapeHtml(taskName));
}
}
details = sb.length() == 0 ? null : sb.toString();
}
} else {
details = null;
}
return details;
} }
@Override @Override
......
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
<property name="order" value="181" /> <property name="order" value="181" />
</bean> </bean>
<bean id="iqtest" class="org.olat.course.nodes.iq.IQTESTCourseNodeConfiguration" scope="prototype" depends-on="qtiResultManager"> <bean id="iqtest" class="org.olat.course.nodes.iq.IQTESTCourseNodeConfiguration" scope="prototype">
<property name="order" value="150" /> <property name="order" value="150" />
</bean> </bean>
......
...@@ -33,6 +33,7 @@ import org.olat.course.nodes.gta.ui.SubmitEvent; ...@@ -33,6 +33,7 @@ import org.olat.course.nodes.gta.ui.SubmitEvent;
import org.olat.course.run.environment.CourseEnvironment; import org.olat.course.run.environment.CourseEnvironment;
import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroup;
import org.olat.group.BusinessGroupRef; import org.olat.group.BusinessGroupRef;
import org.olat.modules.assessment.model.AssessmentEntryStatus;
import org.olat.repository.RepositoryEntry; import org.olat.repository.RepositoryEntry;
import org.olat.repository.RepositoryEntryRef; import org.olat.repository.RepositoryEntryRef;
...@@ -148,6 +149,14 @@ public interface GTAManager { ...@@ -148,6 +149,14 @@ public interface GTAManager {
*/ */
public boolean isTasksInProcess(RepositoryEntryRef entry, GTACourseNode gtaNode); public boolean isTasksInProcess(RepositoryEntryRef entry, GTACourseNode gtaNode);
/**
* Convert the status of a task to the status used by the assessment tool.
* @param task
* @param cNode
* @return
*/
public AssessmentEntryStatus convertToAssessmentEntrystatus(Task task, GTACourseNode cNode);
/** /**
* Are users already processing this task? * Are users already processing this task?
* *
...@@ -158,6 +167,12 @@ public interface GTAManager { ...@@ -158,6 +167,12 @@ public interface GTAManager {
*/ */
public boolean isTaskInProcess(RepositoryEntryRef entry, GTACourseNode gtaNode, String taskName); public boolean isTaskInProcess(RepositoryEntryRef entry, GTACourseNode gtaNode, String taskName);
/**
* Return the details, a string used by the assessment tool
* @return
*/
public String getDetails(Identity assessedIdentity, RepositoryEntryRef entry, GTACourseNode cNode);
public TaskList createIfNotExists(RepositoryEntry entry, GTACourseNode cNode); public TaskList createIfNotExists(RepositoryEntry entry, GTACourseNode cNode);
public TaskList getTaskList(RepositoryEntryRef entry, GTACourseNode cNode); public TaskList getTaskList(RepositoryEntryRef entry, GTACourseNode cNode);
......
...@@ -43,6 +43,7 @@ import org.olat.core.commons.services.notifications.SubscriptionContext; ...@@ -43,6 +43,7 @@ import org.olat.core.commons.services.notifications.SubscriptionContext;
import org.olat.core.id.Identity; import org.olat.core.id.Identity;
import org.olat.core.logging.OLog; import org.olat.core.logging.OLog;
import org.olat.core.logging.Tracing; import org.olat.core.logging.Tracing;
import org.olat.core.util.StringHelper;
import org.olat.core.util.io.SystemFilenameFilter; import org.olat.core.util.io.SystemFilenameFilter;
import org.olat.core.util.vfs.VFSContainer; import org.olat.core.util.vfs.VFSContainer;
import org.olat.core.util.vfs.VFSManager; import org.olat.core.util.vfs.VFSManager;
...@@ -420,6 +421,34 @@ public class GTAManagerImpl implements GTAManager, DeletableGroupData { ...@@ -420,6 +421,34 @@ public class GTAManagerImpl implements GTAManager, DeletableGroupData {
return new Membership(coach, participant); return new Membership(coach, participant);
} }
@Override
public String getDetails(Identity assessedIdentity, RepositoryEntryRef entry, GTACourseNode cNode) {
String details;
if(cNode.getModuleConfiguration().getBooleanSafe(GTACourseNode.GTASK_ASSIGNMENT)) {
List<Task> tasks = getTasks(assessedIdentity, entry, cNode);
if(tasks == null || tasks.isEmpty()) {
details = null;
} else {
StringBuilder sb = new StringBuilder();
for(Task task:tasks) {
if(sb.length() > 0) sb.append(", ");
if(sb.length() > 64) {
sb.append("...");
break;
}
String taskName = task.getTaskName();
if(StringHelper.containsNonWhitespace(taskName)) {
sb.append(StringHelper.escapeHtml(taskName));
}
}
details = sb.length() == 0 ? null : sb.toString();
}
} else {
details = null;
}
return details;
}
@Override @Override
public boolean isTasksInProcess(RepositoryEntryRef entry, GTACourseNode cNode) { public boolean isTasksInProcess(RepositoryEntryRef entry, GTACourseNode cNode) {
List<Number> numOfTasks = dbInstance.getCurrentEntityManager() List<Number> numOfTasks = dbInstance.getCurrentEntityManager()
...@@ -959,11 +988,10 @@ public class GTAManagerImpl implements GTAManager, DeletableGroupData { ...@@ -959,11 +988,10 @@ public class GTAManagerImpl implements GTAManager, DeletableGroupData {
syncAssessmentEntry(taskImpl, cNode); syncAssessmentEntry(taskImpl, cNode);
return taskImpl; return taskImpl;
} }
private void syncAssessmentEntry(TaskImpl taskImpl, GTACourseNode cNode) { @Override
if(taskImpl == null || taskImpl.getTaskStatus() == null || cNode == null) return; public AssessmentEntryStatus convertToAssessmentEntrystatus(Task task, GTACourseNode cNode) {
TaskProcess status = task.getTaskStatus();
TaskProcess status = taskImpl.getTaskStatus();
TaskProcess firstStep = firstStep(cNode); TaskProcess firstStep = firstStep(cNode);
AssessmentEntryStatus assessmentStatus; AssessmentEntryStatus assessmentStatus;
...@@ -976,8 +1004,14 @@ public class GTAManagerImpl implements GTAManager, DeletableGroupData { ...@@ -976,8 +1004,14 @@ public class GTAManagerImpl implements GTAManager, DeletableGroupData {
} else { } else {
assessmentStatus = AssessmentEntryStatus.inProgress; assessmentStatus = AssessmentEntryStatus.inProgress;
} }
return assessmentStatus;
}
private void syncAssessmentEntry(TaskImpl taskImpl, GTACourseNode cNode) {
if(taskImpl == null || taskImpl.getTaskStatus() == null || cNode == null) return;
RepositoryEntry courseRepoEntry = taskImpl.getTaskList().getEntry(); RepositoryEntry courseRepoEntry = taskImpl.getTaskList().getEntry();
AssessmentEntryStatus assessmentStatus = convertToAssessmentEntrystatus(taskImpl, cNode);
if(GTAType.group.name().equals(cNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_TYPE))) { if(GTAType.group.name().equals(cNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_TYPE))) {
//update whole group //update whole group
assessmentService.updateAssessmentEntries(taskImpl.getBusinessGroup(), courseRepoEntry, cNode.getIdent(), null, assessmentStatus); assessmentService.updateAssessmentEntries(taskImpl.getBusinessGroup(), courseRepoEntry, cNode.getIdent(), null, assessmentStatus);
......
...@@ -47,10 +47,10 @@ public class StatusForm extends FormBasicController { ...@@ -47,10 +47,10 @@ public class StatusForm extends FormBasicController {
// This status values will be stored in the db. // This status values will be stored in the db.
// Do not change it, if you have already persistent data. // Do not change it, if you have already persistent data.
private static final String STATUS_VALUE_NOT_OK = "not_ok"; public static final String STATUS_VALUE_NOT_OK = "not_ok";
private static final String STATUS_VALUE_OK = "ok"; public static final String STATUS_VALUE_OK = "ok";
private static final String STATUS_VALUE_WORKING_ON = "working_on"; public static final String STATUS_VALUE_WORKING_ON = "working_on";
private static final String STATUS_VALUE_UNDEFINED = "undefined"; public static final String STATUS_VALUE_UNDEFINED = "undefined";
// Keys to access Locale.properties file // Keys to access Locale.properties file
public static final String STATUS_LOCALE_PROPERTY_PREFIX = "status."; public static final String STATUS_LOCALE_PROPERTY_PREFIX = "status.";
......
This diff is collapsed.
...@@ -92,6 +92,10 @@ ...@@ -92,6 +92,10 @@
<constructor-arg index="0" value="OLAT_10.4.0" /> <constructor-arg index="0" value="OLAT_10.4.0" />
<property name="alterDbStatements" value="alter_10_3_4_to_10_4_0.sql" /> <property name="alterDbStatements" value="alter_10_3_4_to_10_4_0.sql" />
</bean> </bean>
<bean id="database_upgrade_11_0_0" class="org.olat.upgrade.DatabaseUpgrade">
<constructor-arg index="0" value="OLAT_11.0.0" />
<property name="alterDbStatements" value="alter_10_x_0_to_11_0_0.sql" />
</bean>
</list> </list>
</property> </property>
</bean> </bean>
......
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