Skip to content

Let existing goals be edited from the planner and calendar - #46

Merged
geokoko merged 4 commits into
masterfrom
feature/edit-goals
Sep 12, 2026
Merged

geokoko merged 4 commits into
masterfrom
feature/edit-goals

Conversation

@geokoko

@geokoko geokoko commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Existing goals can now be edited wherever they are shown, so a "done when" checklist can be added to goals created before 0.1.8 or extended later.

  • Planner goal rows and calendar goal boxes gain an Edit button. The task panel's goal history already had one.
  • One shared GoalEditFields class builds and validates the description, checklist, and planned date; the three panels dropped their own copies.
  • Checklist ticks survive edits for unchanged lines. The planned date stays editable only while the attempt is pending.

Validation: ./gradlew test passes (79 tests). UI not exercised interactively.

Copilot AI lite review requested due to automatic review settings September 12, 2026 15:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

One or more issues must be addressed before approval.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds editing for existing study goals in the planner and calendar, with shared validation and checklist preservation.

Changes:

  • Added planner and calendar Edit actions.
  • Centralized goal edit fields and validation.
  • Updated project documentation.
File summaries
File Description
src/main/java/com/studysync/presentation/ui/components/TaskManagementPanel.java Updated as part of this pull request.
src/main/java/com/studysync/presentation/ui/components/StudyPlannerPanel.java Updated as part of this pull request.
src/main/java/com/studysync/presentation/ui/components/GoalEditFields.java Updated as part of this pull request.
src/main/java/com/studysync/presentation/ui/components/CalendarViewPanel.java Updated as part of this pull request.
AGENTS.md Updated as part of this pull request.
Review details

Suppressed comments (1)

src/main/java/com/studysync/presentation/ui/components/GoalEditFields.java:17

  • This contract is not true for all goal forms: StudyPlannerPanel.showAddGoalDialog and CalendarViewPanel.showAddGoalDialog still build their own description, checklist, and date controls and validate them independently. Those copies can diverge from GoalEditFields as validation evolves; reuse this component there (with the task selector/date-specific behavior around it) or narrow the documentation to edit dialogs.
/**
 * The fields every goal form shares: description, the "done when" checklist
 * and the planned date. Build one, drop {@link #view()} into any dialog, then
 * call {@link #save} or {@link #create} from its confirm button.
  • Files reviewed: 5/5 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/main/java/com/studysync/presentation/ui/components/CalendarViewPanel.java Outdated
Comment thread src/main/java/com/studysync/presentation/ui/components/StudyPlannerPanel.java Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

One or more issues must be addressed before approval.

Review details

Suppressed comments (1)

src/main/java/com/studysync/presentation/ui/components/CalendarViewPanel.java:1266

  • StudyGoal.findById prefers a pending attempt over achieved/missed attempts, so this reload is not guaranteed to represent the attempt shown in goalBox. For example, editing an achieved attempt after a later retry is planned leaves the old attempt on this date, but updated.getDate() is the retry date and this code removes the still-valid box (and can redraw the wrong attempt when dates coincide). Reload the attempt by its attemptId on the original date and remove the box only when that specific attempt no longer exists there.
            StudyGoal.findById(goal.getId()).ifPresent(updated -> {
                VBox parent = (VBox) goalBox.getParent();
                if (updated.getDate().equals(goal.getDate())) {
                    parent.getChildren().set(parent.getChildren().indexOf(goalBox), createStudyGoalBox(updated));
                } else {
  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

A moderate past-date validation issue remains, and shared dialog paths lack JavaFX-thread coverage.

Review details

Suppressed comments (2)

src/main/java/com/studysync/presentation/ui/components/GoalEditFields.java:49

  • This shared date picker leaves past days selectable. Goal planning elsewhere rejects dates before the current day (StudyService.planGoalAttempt and the planner's add-goal picker), while getGoalsForDate runs the overdue sweep that marks pending attempts before today as MISSED. Editing a pending goal to yesterday therefore silently changes its outcome on the next refresh instead of just rescheduling it; reject past dates in the service and disable them in this shared editor.
        date = new DatePicker(isNew ? defaultDate : goal.getDate());
        date.setMaxWidth(Double.MAX_VALUE);
        date.setDisable(!canEditDate);

src/main/java/com/studysync/presentation/ui/components/GoalEditFields.java:85

  • This new helper is the shared execution path for all three edit dialogs, but the current tests only exercise StudyService.updateStudyGoalDetails; none constructs the JavaFX fields or verifies that blank descriptions/null pending dates keep the dialog open and that a pending date is passed through. A regression here would break planner, calendar, and task-history editing together. Add a JavaFX-thread test for these validation and save paths, similar to SessionVisibilityTest.
    /** Applies the fields to an existing goal; throws with a user-facing message when invalid. */
    void save(StudyService studyService, StudyGoal goal) {
        studyService.updateStudyGoalDetails(goal.getId(), validDescription(),
                canEditDate ? validDate() : null, criteria.getText());
  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No unresolved approval-blocking issues remain.

Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@geokoko
geokoko merged commit f59e0e7 into master Sep 12, 2026
2 checks passed
@geokoko
geokoko deleted the feature/edit-goals branch September 12, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants