Fix localizer warning on the finishing up tab for each author ()

Fixes 

The `getReflectionText` method was calling `getString` when no reflection has been submitted. This is not a relevant case for the editing form since it can not be accessed when there is no reflection. Inlined the method call and removed the non-submitted case, the default will be an empty string.

## How to test
1. Log in as a supervisor
2. Open a project that has a Daisy connection (`identifier`is non-null on the `Project`)
3. Go to the "Finishing up" tab
4. Go to the tab for the author with no reflection submitted
5. See that no warning is logged

Co-authored-by: Nico Athanassiadis <nico@dsv.su.se>
Reviewed-on: 
Reviewed-by: Nico Athanassiadis <nico@dsv.su.se>
Co-authored-by: Andreas Svanberg <andreass@dsv.su.se>
Co-committed-by: Andreas Svanberg <andreass@dsv.su.se>
This commit is contained in:
Andreas Svanberg 2025-02-07 07:50:02 +01:00 committed by Nico Athanassiadis
parent cbbd98b597
commit 219c312441

@ -178,7 +178,13 @@ class ReflectionModalBodyPanel extends Panel {
public SupervisorEditReflectionForm(String id, IModel<Reflection> reflectionModel) {
super(id, reflectionModel);
IModel<String> reflectionTextModel = new Model<>(getReflectionText(reflectionModel.getObject()));
IModel<String> reflectionTextModel = new Model<>();
Reflection reflection = reflectionModel.getObject();
if (reflection instanceof Reflection.Submitted submitted) {
reflectionTextModel.setObject(submitted.reflection());
} else if (reflection instanceof Reflection.ImprovementsNeeded improvementsNeeded) {
reflectionTextModel.setObject(improvementsNeeded.oldReflection());
}
TextArea<String> reflectionTextArea = new TextArea<>("reflection", reflectionTextModel);
reflectionTextArea.setRequired(true);