anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: adessose/budgeteer
Issue: Adding beginning and end to a late project

When I edit a project which existed before (in the view of the Budgeteer data model) a project had a start and end date, in its administration view the project time frame is displayed as the current year, e.g. 1/1/19–12/31/19. This works as expected, as it was the required migrational view.

Now that I come and enter the real date data of the project, e.g., 1/1/16–12/31/16 and save, the view confirms the successful storage of the time frame and... reverts the view to 1/1/19–12/31/19.

It should not be necessary to reload the view to see the correctly stored (but incorrectly not displayed) new project time frame.

As it is a migrational issue, the priority is pretty low. Then again, it should be easy to fix and a good educational example.

Changed files:
budgeteer-web-interface/src/main/java/org/wickedsource/budgeteer/web/pages/administration/ProjectAdministrationPage.java

diff --git a/budgeteer-web-interface/src/main/java/org/wickedsource/budgeteer/web/pages/administration/ProjectAdministrationPage.java b/budgeteer-web-interface/src/main/java/org/wickedsource/budgeteer/web/pages/administration/ProjectAdministrationPage.java
index 3d1ef66d..86f41706 100644
--- a/budgeteer-web-interface/src/main/java/org/wickedsource/budgeteer/web/pages/administration/ProjectAdministrationPage.java
+++ b/budgeteer-web-interface/src/main/java/org/wickedsource/budgeteer/web/pages/administration/ProjectAdministrationPage.java
@@ -70,8 +70,10 @@ public class ProjectAdministrationPage extends BasePage {
             }
         };
         form.add(new TextField<String>("projectTitle", model(from(form.getModelObject()).getName())));
-        DateRange defaultDateRange = new DateRange(DateUtil.getBeginOfYear(), DateUtil.getEndOfYear());
-        form.add(new DateRangeInputField("projectStart", model(from(form.getModelObject()).getDateRange()), defaultDateRange, DateRangeInputField.DROP_LOCATION.DOWN));
+        if (form.getModelObject().getDateRange().getStartDate() == null || form.getModelObject().getDateRange().getEndDate() == null) {
+            form.getModelObject().setDateRange(new DateRange(DateUtil.getBeginOfYear(), DateUtil.getEndOfYear()));
+        }
+        form.add(new DateRangeInputField("projectStart", model(from(form.getModelObject()).getDateRange()), DateRangeInputField.DROP_LOCATION.DOWN));
         return form;
     }