Skip to content

Commit

Permalink
Merge pull request #93 from wafflestudio/feat/chat
Browse files Browse the repository at this point in the history
🔨 Rounding temperature
  • Loading branch information
ws11222 authored Feb 1, 2025
2 parents 021890b + c38c37a commit 45dafc9
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import com.toyProject7.karrot.user.controller.User
import com.toyProject7.karrot.user.service.UserService
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import java.math.BigDecimal
import java.math.RoundingMode

@Service
class MannerService(
Expand Down Expand Up @@ -54,9 +56,15 @@ class MannerService(
}

if (mannerType.name.startsWith("NEG_")) {
userEntity.temperature -= 0.1
userEntity.temperature =
BigDecimal(userEntity.temperature - 0.1)
.setScale(1, RoundingMode.HALF_UP)
.toDouble()
} else {
userEntity.temperature += 0.1
userEntity.temperature =
BigDecimal(userEntity.temperature + 0.1)
.setScale(1, RoundingMode.HALF_UP)
.toDouble()
}

if (userEntity.temperature > 100) {
Expand Down

0 comments on commit 45dafc9

Please sign in to comment.