Specify the type (thesis or individual) of each criterion

This commit is contained in:
Andreas Svanberg 2024-10-21 15:46:52 +02:00
parent 1d3daa5226
commit 56bac63e4f
4 changed files with 41 additions and 0 deletions

@ -65,10 +65,15 @@ class EditingGradingTemplate implements Serializable {
OPPOSITION, REFLECTION
}
enum Type {
PROJECT, INDIVIDUAL
}
private String titleSv;
private String titleEn;
private List<Point> points = new ArrayList<>();
private Flag flag;
private Type type = Type.PROJECT;
Criteria(GradingCriterionTemplate criteria) {
this.titleSv = criteria.getTitle();
@ -82,6 +87,14 @@ class EditingGradingTemplate implements Serializable {
private Criteria() {}
public Type getType() {
return type;
}
public void setType(Type type) {
this.type = type;
}
public String getTitleSv() {
return titleSv;
}

@ -82,6 +82,12 @@
</div>
</div>
<div class="mb-3">
<label class="form-label" wicket:for="type">Type</label>
<select wicket:id="type" class="form-control"></select>
<small class="text-muted">Whether this criterion is assessed once for the thesis or per author.</small>
</div>
<div class="mb-3">
<label class="form-label" wicket:for="flag">Special flag</label>
<select class="form-control" wicket:id="flag"></select>

@ -94,6 +94,26 @@ class EditingGradingTemplateComponentPanel extends GenericPanel<EditingGradingTe
}
});
AjaxDropDownChoice<EditingGradingTemplate.Criteria.Type> typeChoice = new AjaxDropDownChoice<>(
"type",
LambdaModel.of(
model,
EditingGradingTemplate.Criteria::getType,
EditingGradingTemplate.Criteria::setType),
List.of(EditingGradingTemplate.Criteria.Type.values()),
new EnumChoiceRenderer<>(this))
{
@Override
public void onNewSelection(
AjaxRequestTarget target,
EditingGradingTemplate.Criteria.Type objectSelected)
{
// auto save
}
};
typeChoice.setRequired(true);
add(typeChoice);
AjaxDropDownChoice<EditingGradingTemplate.Criteria.Flag> flagChoice = new AjaxDropDownChoice<>(
"flag",
LambdaModel.of(

@ -6,3 +6,5 @@ title_sv.Required=You must set the swedish title for all criteria
title_en.Required=You must set the english title for all criteria
requirement_sv.Required=You must set the swedish requirement for every criteria point
requirement_en.Required=You must set the english requirement for every criteria point
Type.PROJECT=Once per thesis
Type.INDIVIDUAL=Individually for each author