3380 Made it possible to edit minimum/maximum authors
There has always been a minimum and maximum limit on the number of authors per project type, it was just never configurable. Made them configurable while working on the panel.
This commit is contained in:
parent
a48dccc4cd
commit
da842a9fd2
view/src
main/java/se/su/dsv/scipro/admin/panels
test/java/se/su/dsv/scipro/admin/panels
@ -22,6 +22,18 @@
|
|||||||
<label wicket:for="description">Description</label>
|
<label wicket:for="description">Description</label>
|
||||||
<textarea class="form-control" wicket:id="description" cols="60" rows="5"></textarea>
|
<textarea class="form-control" wicket:id="description" cols="60" rows="5"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label wicket:for="minimum_authors">
|
||||||
|
Minimum number of authors per student idea
|
||||||
|
</label>
|
||||||
|
<input class="form-control" type="number" wicket:id="minimum_authors">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label wicket:for="minimum_authors">
|
||||||
|
Maximum number of authors per student idea
|
||||||
|
</label>
|
||||||
|
<input class="form-control" type="number" wicket:id="maximum_authors">
|
||||||
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label wicket:for="minimum_oppositions_to_be_graded">
|
<label wicket:for="minimum_oppositions_to_be_graded">
|
||||||
Minimum approved final seminar oppositions to be graded
|
Minimum approved final seminar oppositions to be graded
|
||||||
|
@ -68,6 +68,22 @@ public class AdminProjectTypePanel extends Panel {
|
|||||||
minimumActiveParticipationsToBeGraded.setMinimum(0);
|
minimumActiveParticipationsToBeGraded.setMinimum(0);
|
||||||
add(minimumActiveParticipationsToBeGraded);
|
add(minimumActiveParticipationsToBeGraded);
|
||||||
|
|
||||||
|
NumberTextField<Integer> minimumAuthors = new NumberTextField<>(
|
||||||
|
"minimum_authors",
|
||||||
|
LambdaModel.of(settings, ProjectTypeSettings::getMinAuthors, ProjectTypeSettings::setMinAuthors),
|
||||||
|
Integer.class);
|
||||||
|
minimumAuthors.setMinimum(1);
|
||||||
|
minimumAuthors.setRequired(true);
|
||||||
|
add(minimumAuthors);
|
||||||
|
|
||||||
|
NumberTextField<Integer> maximumAuthors = new NumberTextField<>(
|
||||||
|
"maximum_authors",
|
||||||
|
LambdaModel.of(settings, ProjectTypeSettings::getMaxAuthors, ProjectTypeSettings::setMaxAuthors),
|
||||||
|
Integer.class);
|
||||||
|
maximumAuthors.setMinimum(1);
|
||||||
|
maximumAuthors.setRequired(true);
|
||||||
|
add(maximumAuthors);
|
||||||
|
|
||||||
Button createButton = new Button("createButton") {
|
Button createButton = new Button("createButton") {
|
||||||
@Override
|
@Override
|
||||||
public void onSubmit() {
|
public void onSubmit() {
|
||||||
|
@ -40,4 +40,19 @@ public class AdminProjectTypePanelTest extends SciProTest {
|
|||||||
|
|
||||||
assertEquals(DegreeType.values()[index], captor.getValue().getDegreeType());
|
assertEquals(DegreeType.values()[index], captor.getValue().getDegreeType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void set_min_max_authors() {
|
||||||
|
FormTester formTester = tester.newFormTester(path(panel, "projectTypeForm"));
|
||||||
|
formTester.setValue("name", "bachelor");
|
||||||
|
formTester.setValue("minimum_authors", "17");
|
||||||
|
formTester.setValue("maximum_authors", "29");
|
||||||
|
formTester.submit("createButton");
|
||||||
|
|
||||||
|
ArgumentCaptor<ProjectType> captor = ArgumentCaptor.forClass(ProjectType.class);
|
||||||
|
verify(projectTypeService).save(captor.capture());
|
||||||
|
|
||||||
|
assertEquals(17, captor.getValue().getProjectTypeSettings().getMinAuthors());
|
||||||
|
assertEquals(29, captor.getValue().getProjectTypeSettings().getMaxAuthors());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user