Skip to content

Commit

Permalink
Merge pull request #35 from Turtle-Neck-Saivor/refactor/34
Browse files Browse the repository at this point in the history
refactor: add normalized info to entity
  • Loading branch information
Sith-call authored Sep 3, 2023
2 parents fcd57fd + 91d70ad commit a3eaefc
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ public class HealthInfo extends BaseEntity {
private Integer yellowCnt;

private Integer greenCnt;
private Double normalizedRedCnt;

private Double normalizedYellowCnt;

private Double normalizedGreenCnt;
private Long shoulderAngle;

private Long headAngle;
Expand All @@ -36,6 +40,7 @@ public class HealthInfo extends BaseEntity {

@Builder
public HealthInfo(MemberEntity memberEntity, Integer redCnt, Integer yellowCnt, Integer greenCnt, Long shoulderAngle, Long headAngle, Long neckAngle, Long distanceMonitor){
int totalCnt = redCnt + yellowCnt + greenCnt;
this.memberEntity = memberEntity;
this.redCnt = redCnt;
this.yellowCnt = yellowCnt;
Expand All @@ -45,5 +50,8 @@ public HealthInfo(MemberEntity memberEntity, Integer redCnt, Integer yellowCnt,
this.headAngle = headAngle;
this.neckAngle = neckAngle;
this.distanceMonitor = distanceMonitor;
this.normalizedGreenCnt = (double) greenCnt / totalCnt;
this.normalizedRedCnt = (double) redCnt / totalCnt;
this.normalizedYellowCnt = (double) yellowCnt / totalCnt;
}
}

0 comments on commit a3eaefc

Please sign in to comment.