Skip to content

Commit

Permalink
add check for get last checkin ordinal
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Nov 21, 2024
1 parent 0fcc86b commit 4a8f6f2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import ch.puzzle.okr.dto.keyresult.*;
import ch.puzzle.okr.mapper.ActionMapper;
import ch.puzzle.okr.models.Action;
import ch.puzzle.okr.models.checkin.CheckIn;
import ch.puzzle.okr.models.checkin.CheckInMetric;
import ch.puzzle.okr.models.checkin.*;
import ch.puzzle.okr.models.keyresult.KeyResult;
import ch.puzzle.okr.models.keyresult.KeyResultMetric;
import ch.puzzle.okr.service.business.CheckInBusinessService;
Expand Down Expand Up @@ -85,7 +84,7 @@ public KeyResult toKeyResultMetric(KeyResultMetricDto keyResultMetricDto) {

public KeyResultLastCheckInMetricDto getLastCheckInDto(Long keyResultId) {
CheckIn lastCheckIn = checkInBusinessService.getLastCheckInByKeyResultId(keyResultId);
if (lastCheckIn == null) {
if (!(lastCheckIn instanceof CheckInMetric)) {
return null;
}
return new KeyResultLastCheckInMetricDto(lastCheckIn.getId(), lastCheckIn.getVersion(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public KeyResult toKeyResultOrdinal(KeyResultOrdinalDto keyResultOrdinalDto) {

public KeyResultLastCheckInOrdinalDto getLastCheckInDto(Long keyResultId) {
CheckIn lastCheckIn = checkInBusinessService.getLastCheckInByKeyResultId(keyResultId);
if (lastCheckIn == null) {
if (!(lastCheckIn instanceof CheckInOrdinal)) {
return null;
}
return new KeyResultLastCheckInOrdinalDto(lastCheckIn.getId(), lastCheckIn.getVersion(),
Expand Down

0 comments on commit 4a8f6f2

Please sign in to comment.