Skip to content
Snippets Groups Projects
Commit 2919b611 authored by uhensler's avatar uhensler
Browse files

OO-4080: Particular icon for stared but not yet finished evaluation

parent c6dddb86
No related branches found
No related tags found
No related merge requests found
Showing with 85 additions and 18 deletions
/**
* <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.core.gui.components.form.flexible.impl.elements.table;
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;
/**
*
* Initial date: 21.06.2019<br>
* @author uhensler, urs.hensler@frentix.com, http://www.frentix.com
*
*/
public class BooleanNullCellRenderer implements FlexiCellRenderer {
private final FlexiCellRenderer trueDelegate;
private final FlexiCellRenderer falseDelegate;
private final FlexiCellRenderer nullDelegate;
public BooleanNullCellRenderer(FlexiCellRenderer trueDelegate, FlexiCellRenderer falseDelegate, FlexiCellRenderer nullDelegate) {
this.trueDelegate = trueDelegate;
this.falseDelegate = falseDelegate;
this.nullDelegate = nullDelegate;
}
@Override
public void render(Renderer renderer, StringOutput target, Object cellValue, int row, FlexiTableComponent source, URLBuilder ubu, Translator translator) {
if (cellValue == null && nullDelegate != null) {
nullDelegate.render(null, target, cellValue, row, source, ubu, translator);
} else if(Boolean.TRUE.equals(cellValue) && trueDelegate != null) {
trueDelegate.render(null, target, cellValue, row, source, ubu, translator);
} else if(Boolean.FALSE.equals(cellValue) && falseDelegate != null) {
falseDelegate.render(null, target, cellValue, row, source, ubu, translator);
}
}
}
......@@ -20,11 +20,13 @@
package org.olat.course.nodes.ms;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer;
import org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer;
import org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanNullCellRenderer;
import org.olat.core.gui.components.form.flexible.impl.elements.table.CSSIconFlexiCellRenderer;
import org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel;
import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel;
......@@ -41,6 +43,7 @@ import org.olat.modules.assessment.ui.AssessedIdentityElementRow;
import org.olat.modules.assessment.ui.AssessmentToolContainer;
import org.olat.modules.assessment.ui.AssessmentToolSecurityCallback;
import org.olat.modules.forms.EvaluationFormSession;
import org.olat.modules.forms.EvaluationFormSessionStatus;
import org.olat.repository.RepositoryEntry;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -82,7 +85,10 @@ public class MSIdentityListCourseNodeController extends IdentityListCourseNodeCo
if (hasEvaluationForm()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.details.ms",
IdentityCourseElementCols.details.ordinal(),
new BooleanCellRenderer(new CSSIconFlexiCellRenderer("o_icon_lg o_icon_check"), null)));
new BooleanNullCellRenderer(
new CSSIconFlexiCellRenderer("o_icon_lg o_icon_ms_done"),
new CSSIconFlexiCellRenderer("o_icon_lg o_icon_ms_pending"),
null)));
}
super.initScoreColumns(columnsModel);
}
......@@ -92,14 +98,18 @@ public class MSIdentityListCourseNodeController extends IdentityListCourseNodeCo
super.loadModel(ureq);
if (hasEvaluationForm()) {
List<EvaluationFormSession> sessions = msService.getDoneSessions(getCourseRepositoryEntry(), courseNode.getIdent());
List<String> idents = sessions.stream()
.map(s -> s.getSurvey().getIdentifier().getSubident2())
.collect(Collectors.toList());
List<EvaluationFormSession> sessions = msService.getSessions(getCourseRepositoryEntry(), courseNode.getIdent());
Map<String, EvaluationFormSession> identToSesssion = sessions.stream()
.collect(Collectors.toMap(
s -> s.getSurvey().getIdentifier().getSubident2(),
Function.identity()));
for (AssessedIdentityElementRow row : usersTableModel.getObjects()) {
String ident = row.getIdentityKey().toString();
Boolean sessionDone = idents.contains(ident);
EvaluationFormSession session = identToSesssion.get(ident);
Boolean sessionDone = session != null
? EvaluationFormSessionStatus.done.equals(session.getEvaluationFormSessionStatus())
: null;
row.setDetails(sessionDone);
}
}
......
......@@ -47,7 +47,7 @@ public interface MSService {
boolean hasSessions(OLATResourceable ores, String nodeIdent);
List<EvaluationFormSession> getDoneSessions(OLATResourceable ores, String nodeIdent);
List<EvaluationFormSession> getSessions(OLATResourceable ores, String nodeIdent);
void deleteSessions(RepositoryEntry ores, String nodeIdent);
......
......@@ -122,8 +122,8 @@ public class MSServiceImpl implements MSService {
}
@Override
public List<EvaluationFormSession> getDoneSessions(OLATResourceable ores, String nodeIdent) {
SessionFilter filter = SessionFilterFactory.createSelectDone(of(ores, nodeIdent));
public List<EvaluationFormSession> getSessions(OLATResourceable ores, String nodeIdent) {
SessionFilter filter = SessionFilterFactory.create(of(ores, nodeIdent));
return evaluationFormManager.loadSessionsFiltered(filter, 0, -1);
}
......
......@@ -43,6 +43,10 @@ public class SessionFilterFactory {
return new SessionRefFilter(sessionRefs);
}
public static SessionFilter create(EvaluationFormSurveyIdentifier surveyIdentitfier) {
return new SurveysFilter(surveyIdentitfier);
}
public static SessionFilter createSelectDone(EvaluationFormSurveyRef survey) {
return createSelectDone(Collections.singletonList(survey));
}
......@@ -50,8 +54,4 @@ public class SessionFilterFactory {
public static SessionFilter createSelectDone(Collection<? extends EvaluationFormSurveyRef> surveys) {
return new SurveysFilter(surveys, EvaluationFormSessionStatus.done);
}
public static SessionFilter createSelectDone(EvaluationFormSurveyIdentifier surveyIdentitfier) {
return new SurveysFilter(surveyIdentitfier, EvaluationFormSessionStatus.done);
}
}
......@@ -180,6 +180,8 @@ $fa-css-prefix: "o_icon" !default;
.o_icon_move_left:before { content: $fa-var-angle-double-left;}
.o_icon_move_right:before { content: $fa-var-angle-double-right;}
.o_icon_move_up:before { content: $fa-var-angle-double-up;}
.o_icon_ms_done:before { content: $fa-var-check-circle;}
.o_icon_ms_pending:before { content: $fa-var-circle-o;}
.o_icon_new:before { content: $fa-var-asterisk; color: $brand-success;}
.o_icon_new_document:before { content: $fa-var-file-text; }
.o_icon_new_folder:before { content: $fa-var-folder;}
......
source diff could not be displayed: it is too large. Options to address this: view the blob.
source diff could not be displayed: it is too large. Options to address this: view the blob.
source diff could not be displayed: it is too large. Options to address this: view the blob.
source diff could not be displayed: it is too large. Options to address this: view the blob.
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