Skip to content
Snippets Groups Projects
Commit 915e5dcc authored by srosse's avatar srosse
Browse files

OO-5272: show the primary key in the table

parent 47f9a9e5
No related branches found
No related tags found
No related merge requests found
......@@ -193,7 +193,7 @@ public class CertificateAndEfficiencyStatementCurriculumListController extends F
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
//
}
@Override
......@@ -211,9 +211,6 @@ public class CertificateAndEfficiencyStatementCurriculumListController extends F
elementIdentifierCol.setCellRenderer(new CurriculumElementCompositeRenderer("select", new TextFlexiCellRenderer()));
columnsModel.addFlexiColumnModel(elementIdentifierCol);
// Name column
// columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, ElementViewCols.select));
if (roleSecurityCallback.canViewCourseProgressAndStatus()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ElementViewCols.passed));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ElementViewCols.completion));
......@@ -476,14 +473,6 @@ public class CertificateAndEfficiencyStatementCurriculumListController extends F
params.setMembershipMandatory(true);
List<RepositoryEntryMyView> courses = repositoryService.searchMyView(params, 0, 0);
// // Filter for entries which have a efficiency statement
// Set<Long> alreadyAdded = new HashSet<>();
// for (CurriculumTreeWithViewsRow row : allRows) {
// for (RepositoryEntryMyView entry : row.getEntries()) {
// alreadyAdded.add(entry.getOlatResource().getKey());
// }
// }
courses.removeIf(course -> alreadyAdded.contains(course.getOlatResource().getKey()));
// Filter for entries which are without curriculum
......@@ -653,13 +642,14 @@ public class CertificateAndEfficiencyStatementCurriculumListController extends F
}
private void forgeCurriculumCompletions(List<CurriculumTreeWithViewsRow> rows) {
Map<Long, Double> completions = loadCurriculumElementCompletions(rows);
for (CurriculumTreeWithViewsRow row : rows) {
if (row.getCompletionItem() == null) { // does not show completion of the child entry
forgeCompletion(row, completions.get(row.getKey()));
}
}
Map<Long, Double> completions = loadCurriculumElementCompletions(rows);
if(!completions.isEmpty()) {
for (CurriculumTreeWithViewsRow row : rows) {
if (row.getCompletionItem() == null && row.getCurriculumElementKey() != null) { // does not show completion of the child entry
forgeCompletion(row, completions.get(row.getCurriculumElementKey()));
}
}
}
}
private void forgeCompletion(CurriculumTreeWithViewsRow row, Double completion) {
......@@ -873,29 +863,4 @@ public class CertificateAndEfficiencyStatementCurriculumListController extends F
return true;
}
}
private List<CurriculumTreeWithViewsRow> sortCurriculumRows(List<CurriculumTreeWithViewsRow> rows) {
List<CurriculumTreeWithViewsRow> sortedRows = rows.stream().filter(row -> row. getLevel() == 0).collect(Collectors.toList());
for (CurriculumTreeWithViewsRow parent : sortedRows) {
if (parent.hasChildren()) {
sortedRows.addAll(sortedRows.indexOf(parent) + 1, sortCurriculumRows(rows, parent));
}
}
return sortedRows;
}
private List<CurriculumTreeWithViewsRow> sortCurriculumRows(List<CurriculumTreeWithViewsRow> rows, CurriculumTreeWithViewsRow parent) {
List<CurriculumTreeWithViewsRow> filteredRows = rows.stream().filter(row -> row.getParent() != null && row.getParent().equals(parent)).collect(Collectors.toList());
List<CurriculumTreeWithViewsRow> sortedRows = new ArrayList<>(filteredRows);
for (CurriculumTreeWithViewsRow child : filteredRows) {
if (child.hasChildren()) {
sortedRows.addAll(filteredRows.indexOf(child) + 1, sortCurriculumRows(rows, parent));
}
}
return filteredRows;
}
}
......@@ -51,10 +51,8 @@ public class CertificateAndEfficiencyStatementWrapperController extends BasicCon
private final TooledStackedPanel stackPanel;
private final Identity mentee;
private final StudentStatEntry statEntry;
private final CurriculumSecurityCallback curriculumSecurityCallback;
private final RoleSecurityCallback roleSecurityCallback;
private final List<CurriculumRef> curriculumRefs;
private CertificateAndEfficiencyStatementCurriculumListController certificateCurriculumListController;
private CertificateAndEfficiencyStatementListController certificateListController;
......@@ -69,15 +67,15 @@ public class CertificateAndEfficiencyStatementWrapperController extends BasicCon
@Autowired
CurriculumModule curriculumModule;
public CertificateAndEfficiencyStatementWrapperController(UserRequest ureq, WindowControl wControl, TooledStackedPanel stackPanel, Identity mentee, CurriculumSecurityCallback curriculumSecurityCallback, RoleSecurityCallback roleSecurityCallback, List<CurriculumRef> curriculumRefs, StudentStatEntry statEntry) {
public CertificateAndEfficiencyStatementWrapperController(UserRequest ureq, WindowControl wControl, TooledStackedPanel stackPanel, Identity mentee,
CurriculumSecurityCallback curriculumSecurityCallback, RoleSecurityCallback roleSecurityCallback,
List<CurriculumRef> curriculumRefs, StudentStatEntry statEntry) {
super(ureq, wControl);
this.stackPanel = stackPanel;
this.mentee = mentee;
this.curriculumSecurityCallback = curriculumSecurityCallback;
this.roleSecurityCallback = roleSecurityCallback;
this.curriculumRefs = curriculumRefs;
this.statEntry = statEntry;
content = createVelocityContainer("certificate_list_wrapper");
showCurriculum = curriculumModule.isEnabled() && roleSecurityCallback.canViewCoursesAndCurriculum();
......
......@@ -45,6 +45,8 @@ import org.olat.modules.lecture.model.LectureBlockStatistics;
*/
public class CurriculumElementWithViewsDataModel extends DefaultFlexiTreeTableDataModel<CurriculumTreeWithViewsRow> implements FlexiBusinessPathModel {
private static final ElementViewCols[] COLS = ElementViewCols.values();
private ConcurrentMap<IdentityResourceKey, CertificateLight> certificateMap;
private ConcurrentMap<IdentityRepositoryEntryKey, LectureBlockStatistics> lecturesStatisticsMap;
......@@ -106,8 +108,8 @@ public class CurriculumElementWithViewsDataModel extends DefaultFlexiTreeTableDa
@Override
public Object getValueAt(int row, int col) {
CurriculumTreeWithViewsRow curriculum = getObject(row);
switch(ElementViewCols.values()[col]) {
case key: return curriculum.getKey();
switch(COLS[col]) {
case key: return curriculum.getId();
case displayName:
return curriculum.getDisplayName();
case hasStatement:
......
......@@ -279,6 +279,22 @@ public class CurriculumTreeWithViewsRow implements CurriculumTreeWithView, Flexi
}
}
public Long getId() {
if ((repositoryEntry == null || singleEntry) && element != null) {
return element.getKey();
}
if (isCurriculum()) {
return curriculum.getKey();
}
if (repositoryEntry != null) {
return repositoryEntry.getKey();
}
if (element != null) {
return element.getKey();
}
return null;
}
public String getCurriculumElementExternalId() {
return element == null ? null : element.getExternalId();
}
......
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