Skip to content

Commit a7290aa

Browse files
ddamkeddamke
authored andcommitted
remove unnecessary logic instead added better if statement
1 parent 1581caf commit a7290aa

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

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

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -167,23 +167,17 @@ private void changeProject(final Project newProject, final long minusSeconds) {
167167
if (hideable) {
168168
mainStage.hide();
169169
}
170-
if (model.remindIfNotesAreEmpty.get()) {
171-
final Work currentWork = model.activeWorkItem.get();
172-
if (currentWork != null && currentWork.getNotes().isEmpty() ) {
173-
if (showNoNoteSelected(currentWork)) return;
174-
}
175-
}
176-
if (model.remindIfNotesAreEmptyIsWork.get()) {
177-
final Work currentWork = model.activeWorkItem.get();
178-
if (currentWork != null && currentWork.getNotes().isEmpty() &&currentWork.getProject().isWork()) {
179-
if (showNoNoteSelected(currentWork)) return;
170+
final Work currentWork = model.activeWorkItem.get();
171+
if (model.remindIfNotesAreEmpty.get() && currentWork.getNotes().isEmpty()) {
172+
173+
if (currentWork != null && (!model.remindIfNotesAreEmptyIsWork.get() || currentWork.getProject().isWork())) {
174+
if (showDialogNoNoteSelected(currentWork)) return;
180175
}
181176
}
182177
controller.changeProject(newProject, minusSeconds);
183-
184178
}
185179

186-
private boolean showNoNoteSelected(Work currentWork) {
180+
private boolean showDialogNoNoteSelected(Work currentWork) {
187181
final TextInputDialog noteDialog = new TextInputDialog();
188182
noteDialog.setTitle("Empty Notes");
189183
noteDialog.setHeaderText("Switch projects without notes?");

0 commit comments

Comments
 (0)