-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] #43 일치율 계산을 위한 service util 객체 생성
- Loading branch information
1 parent
d749c08
commit 0abb646
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/main/java/org/gachon/checkmate/domain/checkList/utils/MatchRateCalculator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.gachon.checkmate.domain.checkList.utils; | ||
|
||
import org.gachon.checkmate.domain.checkList.entity.CheckList; | ||
import org.gachon.checkmate.domain.checkList.entity.PostCheckList; | ||
|
||
public class MatchRateCalculator { | ||
public static int getAccuracy(PostCheckList postCheckList, CheckList checkList) { | ||
int count = 0; | ||
count += postCheckList.getCleanType().compareRateTo(checkList.getCleanType()); | ||
count += postCheckList.getDrinkType().compareRateTo(checkList.getDrinkType()); | ||
count += postCheckList.getHomeType().compareRateTo(checkList.getHomeType()); | ||
count += postCheckList.getLifePatternType().compareRateTo(checkList.getLifePatternType()); | ||
count += postCheckList.getNoiseType().compareRateTo(checkList.getNoiseType()); | ||
count += postCheckList.getSleepGridingType().compareRateTo(checkList.getSleepGridingType()); | ||
count += postCheckList.getSleepSnoreType().compareRateTo(checkList.getSleepSnoreType()); | ||
count += postCheckList.getSleepTalkingType().compareRateTo(checkList.getSleepTalkingType()); | ||
count += postCheckList.getSleepTurningType().compareRateTo(checkList.getSleepTurningType()); | ||
count += postCheckList.getSmokeType().compareRateTo(checkList.getSmokeType()); | ||
return (int) (count / 10) * 100; | ||
} | ||
|
||
} |