Skip to content

Commit

Permalink
Merge pull request #26 from jjuuuunnii/main
Browse files Browse the repository at this point in the history
Feat: 각 wear 업데이트 로직 변경
  • Loading branch information
jjuuuunnii authored Jan 12, 2024
2 parents 4d4cdaf + eb13c4c commit a5e13a0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
22 changes: 11 additions & 11 deletions src/main/java/com/snowthon/snowman/domain/wear/HeadWear.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ public void updateVote(EHeadWear headWear) {
} else if (headWear == EHeadWear.BALACLAVA) {
this.balaclavaCnt++;
}
double totalVotes = earmuffCnt + balaclavaCnt;
double earmuffScore = (totalVotes > 0) ? (earmuffCnt / totalVotes) * 0.5 : 0;
double balaclavaScore = (totalVotes > 0) ? (balaclavaCnt / totalVotes) * 0.5 : 0;
if (this.eheadWear == EHeadWear.EAR_MUFFS) {
earmuffScore += 0.5;
} else if (this.eheadWear == EHeadWear.BALACLAVA) {
balaclavaScore += 0.5;
} else if (this.eheadWear == EHeadWear.NONE) {
return;
}
this.eheadWear = earmuffScore > balaclavaScore ? EHeadWear.EAR_MUFFS : EHeadWear.BALACLAVA;
// double totalVotes = earmuffCnt + balaclavaCnt;
// double earmuffScore = (totalVotes > 0) ? (earmuffCnt / totalVotes) * 0.5 : 0;
// double balaclavaScore = (totalVotes > 0) ? (balaclavaCnt / totalVotes) * 0.5 : 0;
// if (this.eheadWear == EHeadWear.EAR_MUFFS) {
// earmuffScore += 0.5;
// } else if (this.eheadWear == EHeadWear.BALACLAVA) {
// balaclavaScore += 0.5;
// } else if (this.eheadWear == EHeadWear.NONE) {
// return;
// }
this.eheadWear = this.earmuffCnt >= this.balaclavaCnt ? EHeadWear.EAR_MUFFS : EHeadWear.BALACLAVA;
}

}
16 changes: 8 additions & 8 deletions src/main/java/com/snowthon/snowman/domain/wear/NeckWear.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ public void updateVote(ENeckWear neckWear) {
if (neckWear == ENeckWear.SCARF) {
this.scarfCnt++;
}
double totalVotes = scarfCnt;
double scarfScore = (totalVotes > 0) ? (scarfCnt / totalVotes) * 0.5 : 0;
if (this.eNeckWear == ENeckWear.SCARF) {
scarfScore += 0.5;
} else if (this.eNeckWear == ENeckWear.NONE) {
return;
}
this.eNeckWear = scarfScore > 0.5 ? ENeckWear.SCARF : ENeckWear.NONE;
// double totalVotes = scarfCnt;
// double scarfScore = (totalVotes > 0) ? (scarfCnt / totalVotes) * 0.5 : 0;
// if (this.eNeckWear == ENeckWear.SCARF) {
// scarfScore += 0.5;
// } else if (this.eNeckWear == ENeckWear.NONE) {
// return;
// }
this.eNeckWear = this.scarfCnt > 0 ? ENeckWear.SCARF : ENeckWear.NONE;
}
}
6 changes: 3 additions & 3 deletions src/main/java/com/snowthon/snowman/domain/wear/OuterWear.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void updateVote(EOuterWear outerWear) {
} else if (outerWear == EOuterWear.COAT) {
this.coatCnt++;
}
double totalVotes = longPaddingCnt + shortPaddingCnt + coatCnt;
/* double totalVotes = longPaddingCnt + shortPaddingCnt + coatCnt;
double longPaddingScore = (totalVotes > 0) ? (longPaddingCnt / totalVotes) * 0.33 : 0;
double shortPaddingScore = (totalVotes > 0) ? (shortPaddingCnt / totalVotes) * 0.33 : 0;
double coatScore = (totalVotes > 0) ? (coatCnt / totalVotes) * 0.33 : 0;
Expand All @@ -77,7 +77,7 @@ public void updateVote(EOuterWear outerWear) {
coatScore += 0.33;
} else if(this.eOuterWear == EOuterWear.NONE){
return;
}
this.eOuterWear = (longPaddingScore > shortPaddingScore) ? (longPaddingScore > coatScore ? EOuterWear.LONG_PADDING : EOuterWear.COAT) : (shortPaddingScore > coatScore ? EOuterWear.SHORT_PADDING : EOuterWear.COAT);
}*/
this.eOuterWear = (this.longPaddingCnt >= this.shortPaddingCnt) ? (this.longPaddingCnt >= this.coatCnt ? EOuterWear.LONG_PADDING : EOuterWear.COAT) : (this.shortPaddingCnt >= this.coatCnt ? EOuterWear.SHORT_PADDING : EOuterWear.COAT);
}
}
6 changes: 3 additions & 3 deletions src/main/java/com/snowthon/snowman/domain/wear/TopWear.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ public void updateVote(ETopWear topWear) {
} else if (topWear == ETopWear.LONG_SLEEVE) {
this.longSleeveCnt++;
}
double totalVotes = neatCnt + longSleeveCnt;
/* double totalVotes = neatCnt + longSleeveCnt;
double neatScore = (totalVotes > 0) ? (neatCnt / totalVotes) * 0.5 : 0;
double longSleeveScore = (totalVotes > 0) ? (longSleeveCnt / totalVotes) * 0.5 : 0;
if (this.eTopWear == ETopWear.NEAT) {
neatScore += 0.5;
}else{
longSleeveScore += 0.5;
}
this.eTopWear = longSleeveScore > neatScore ? ETopWear.LONG_SLEEVE : ETopWear.NEAT;
}*/
this.eTopWear = this.longSleeveCnt >= this.neatCnt ? ETopWear.LONG_SLEEVE : ETopWear.NEAT;
}
}

0 comments on commit a5e13a0

Please sign in to comment.