Skip to content

Conversation

@MomdAli
Copy link
Collaborator

@MomdAli MomdAli commented Sep 12, 2025

Mapping logic and data integrity:

  • Refactored the mapping logic in HeimatController.getTableRows() to ensure that all projects mapped to the same Heimat task are grouped together, even if some projects have no worked time, making the mapping more robust and comprehensive.
  • Improved handling of Heimat tasks present in mappings but missing from the current API response, ensuring these are still shown and flagged as pending removal rather than silently dropped.
  • Added a new method getAllKnownHeimatTasks() to merge tasks from both API and persisted mappings, ensuring no mapped tasks are lost in the UI.

User interface and messaging:

  • Changed sync status messages from plain strings to styled TextFlow components, allowing for richer and more readable feedback in the UI (e.g., bold task names and clearer explanations).
  • Added logic in ExternalProjectsMapController to display a warning dialog for mappings that reference missing Heimat tasks, and to allow the user to clear these mappings if desired.

Bug fixes and validation:

  • Fixed a bug in FileOpenHelper.openFile() where the file existence check was inverted, ensuring files are only opened if they actually exist and are regular files.
  • Added a pendingRemoval flag to ProjectMapping to track mappings that should be removed due to missing Heimat tasks, improving data consistency and user awareness.

* Added tooltip
* Enabled search in comboboxes
* Expired token now shown in red
* Fixed SyncDialog auto-close
* Made auto-deletion of obsolete mappings optional (Keep/Remove)
@MomdAli MomdAli self-assigned this Sep 12, 2025
@MomdAli MomdAli requested a review from Death111 September 15, 2025 09:15
@MomdAli MomdAli marked this pull request as ready for review September 15, 2025 09:15
@Death111 Death111 changed the base branch from develop to feature/PTBAS-738_syncDialogAnpassungen October 20, 2025 16:18
Base automatically changed from feature/PTBAS-738_syncDialogAnpassungen to develop October 23, 2025 16:06
# Conflicts:
#	src/main/java/de/doubleslash/keeptime/controller/HeimatController.java
#	src/main/java/de/doubleslash/keeptime/view/ExternalProjectsSyncController.java
#	src/main/java/de/doubleslash/keeptime/viewpopup/SearchCombobox.java
#	src/test/java/de/doubleslash/keeptime/controller/HeimatControllerTest.java
if (optionalExistingMapping.isPresent()) {
final Mapping existingMapping = optionalExistingMapping.get();

// Ensure we merge projects robustly: include any projects mapped to the same Heimat task
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I would like to only have projects shown in the dialog, which I also worked on at that date. not all projects which are mapped to it

Copy link
Collaborator

Choose a reason for hiding this comment

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

hm okay. but when I dont have the time in keeptime but heimat, what should it show for keeptime projects? not so sure if no projects would be wanted (which would be the case when adapting as I wanted it)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

// shouldOnlyUpdateHeimatWhenSomethingHasChanged (not needed - user should decide)

@Test
void shouldNotCreateDuplicateHeimatEntryWhenMultipleProjectsMappedAndSomeHaveWork() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I do not think that this "GIVEN" created the issue observed. Running this test on previous code fails yes - but not because the report has 2 rows in the end - which was the issue that we see the same twice.

It failse because the other project is not contained in the projects (Matchers.containsInAnyOrder(workProject1, workProject2)).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

}
}

public List<HeimatTask> getAllKnownHeimatTasks(final LocalDate forDate) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure why we need this. It is referenced in some places - but not sure why we need it. need to dig deeper to understand why we need this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The method gets tasks from the API for that date (via getTasks), and also includes tasks from stored mappings (even if not available today) and merges both.

private Label heimatExpiresLabel;

@FXML
private Label expirationDateLabel;
Copy link
Collaborator

Choose a reason for hiding this comment

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

we can write all info into existing heimatExpiresLabel? or why do we need a 2nd label for this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

ah I see. the label holds the row-name for the setting "Expires:" <value> currently. Still, I would keep this as is and ad the Expired info to the value displayed.
Feels a little uncommon that the value description changes for me :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

} catch(Exception e){
heimatExpiresLabel.setText("Does not seem to be valid");
heimatExpiresLabel.setText("");
expirationDateLabel.setText("Does not seem to be valid");
Copy link
Collaborator

Choose a reason for hiding this comment

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

could also set it to color red if its not valid

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

final ObservableList<HeimatController.ProjectMapping> newProjectMappings = FXCollections.observableArrayList(
previousProjectMappings);

Platform.runLater(() -> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

runLater with a dialog which modifies the ui 'indirectly' seems not soo nice. not sure if we could solve this differently

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I changed it to use on thisStage.setOnShown, however I don"t know if that is a good idea, so I will leave it but if you want to revert it then feel free to tell me.

@Death111
Copy link
Collaborator

Death111 commented Nov 10, 2025

in sync dialog times which exist in heimat but not in keeptime the projects are not shown in bold. might fix in this pr

* improve test
* improve expiration label
* refactor code in ExternalProjectsMapController
* fix work stacking when it is not needed
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.

3 participants