Skip to content

Commit

Permalink
[feat] #43 일치율 계산을 위한 service util 객체 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
RyuKwanKon committed Jan 13, 2024
1 parent d749c08 commit 0abb646
Showing 1 changed file with 22 additions and 0 deletions.
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;
}

}

0 comments on commit 0abb646

Please sign in to comment.