Skip to content

Commit

Permalink
Fixed resume to create a new item instead of persisting the old item …
Browse files Browse the repository at this point in the history
…again
  • Loading branch information
Bytekeeper committed Apr 10, 2015
1 parent 74eb6fa commit 04fc9bc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/main/java/org/stt/ToItemWriterCommandHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ public Optional<TimeTrackingItem> endCurrentItem(DateTime endTime) {

@Override
public void resumeGivenItem(TimeTrackingItem item) {
TimeTrackingItem newItem = new TimeTrackingItem(
item.getComment().get(), DateTime.now());
parser.resumeItemCommand(newItem).execute();
parser.resumeItemCommand(item).execute();
}

@Override
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/stt/command/CommandParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ public Optional<Command> endCurrentItemCommand(DateTime endTime) {
}

public Command resumeItemCommand(final TimeTrackingItem item) {
return new ResumeCommand(persister, item);
TimeTrackingItem newItem = new TimeTrackingItem(
item.getComment().get(), DateTime.now());
return new ResumeCommand(persister, newItem);
}

public Command deleteCommandFor(TimeTrackingItem item) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/stt/gui/jfx/STTApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ private void updateItems() {

@Override
public void continueItem(TimeTrackingItem item) {
LOG.severe("Continuing item: " + item);
commandParser.resumeItemCommand(item).execute();
viewAdapter.shutdown();
}
Expand Down

0 comments on commit 04fc9bc

Please sign in to comment.