Skip to content

Commit

Permalink
fix: fix calculate best workout score method
Browse files Browse the repository at this point in the history
  • Loading branch information
aiaiaiai1 committed Nov 3, 2024
1 parent 4cd8a15 commit 92bcfd8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/main/java/gymmi/workspace/domain/WorkoutMetric.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package gymmi.workspace.domain;

import gymmi.workspace.domain.entity.WorkoutHistory;

import java.util.Collections;
import java.util.List;

Expand All @@ -21,7 +22,7 @@ public int getWorkoutCount() {
public int getBestWorkoutScore() {
return workoutHistories.stream()
.mapToInt(w -> w.getTotalScore())
.max().getAsInt();
.max().orElse(0);
}

public int getSum() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class WorkoutRecord {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@JoinColumn(name = "working_id", nullable = false)
@JoinColumn(name = "workout_history_id", nullable = false)
@ManyToOne(fetch = FetchType.LAZY)
private WorkoutHistory workoutHistory;

Expand Down

0 comments on commit 92bcfd8

Please sign in to comment.