Skip to content

Commit 44366e2

Browse files
committed
#178: show project name which had sync errors (if present). shorter delay
1 parent 0bd2583 commit 44366e2

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/main/java/de/doubleslash/keeptime/view/ExternalProjectsSyncController.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -353,19 +353,23 @@ protected List<HeimatController.HeimatErrors> call() {
353353
final List<HeimatController.HeimatErrors> errors = task.getValue();
354354
if (!errors.isEmpty()) {
355355
loadingScreenShowSyncing("Something did not work :(", loadingFailure);
356-
List<String> a = errors.stream()
357-
.map(error -> error.mapping().mapping().heimatTaskId() + ": "
358-
+ error.errorMessage() + ". Wanted to store '" + error.mapping()
356+
List<String> a = errors.stream().map(error -> {
357+
final List<Project> projects = error.mapping().mapping().projects();
358+
// TODO would be nice to show heimat task name but we only have ID here
359+
final String projectName = !projects.isEmpty()
360+
? projects.get(0).getName()
361+
: Long.toString(error.mapping().mapping().heimatTaskId());
362+
return projectName + ": " + error.errorMessage() + ". Wanted to store '" + error.mapping()
359363
.userMinutes()
360-
+ "' minutes with notes '" + error.mapping().userNotes() + "'")
361-
.toList();
364+
+ "' minutes with notes '" + error.mapping().userNotes() + "'";
365+
}).toList();
362366

363367
showErrorDialog(a);
364368
} else {
365369
loadingScreenShowSyncing("Successfully synced!", loadingSuccess);
366370
}
367371

368-
PauseTransition delay = new PauseTransition(Duration.seconds(3));
372+
PauseTransition delay = new PauseTransition(Duration.seconds(2));
369373
delay.setOnFinished(event -> {
370374
showLoadingScreen(false);
371375
thisStage.close();

0 commit comments

Comments
 (0)