Skip to content

Commit

Permalink
[BLOOM-077] 식물 물주기 방법 분리 (#82)
Browse files Browse the repository at this point in the history
* fix: Plant의 계절별 물주기 방법을 4가지로 분리

* test: 테스트 오류 수정
  • Loading branch information
Dompoo authored Aug 22, 2024
1 parent 412b33a commit bbb5e90
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ data class PlantRecommendedPeriodResponse(

val waterInfo =
when (season) {
Season.SPRING -> plant.springWater
Season.SUMMER -> plant.summerWater
Season.FALL -> plant.fallWater
Season.WINTER -> plant.winterWater
else -> plant.springSummerFallWater
}

return PlantRecommendedPeriodResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ class StaticPlantSimpleMessageProvider {
): String {
val water =
when (Season.getSeason(month)) {
Season.SPRING -> plant.springWater
Season.SUMMER -> plant.summerWater
Season.FALL -> plant.fallWater
Season.WINTER -> plant.winterWater
else -> plant.springSummerFallWater
}

return "${water.waterPerWeek},\n${water.description}할 것"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class WaterDetailProvider {
}

private fun makeDetailSpringSummerFallDescription(plant: Plant): String {
val waterDescription = "${plant.springSummerFallWater.description}해주세요."
val perWeekDescription = "일주일에 ${plant.springSummerFallWater.waterPerWeek}번 정도가 적당해요."
val waterDescription = "${plant.summerWater.description}해주세요."
val perWeekDescription = "일주일에 ${plant.summerWater.waterPerWeek}번 정도가 적당해요."
return "$waterDescription $perWeekDescription"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ class Plant(
var engName: String,
@Column
@Enumerated(EnumType.STRING)
var springSummerFallWater: Water,
var springWater: Water,
@Column
@Enumerated(EnumType.STRING)
var summerWater: Water,
@Column
@Enumerated(EnumType.STRING)
var fallWater: Water,
@Column
@Enumerated(EnumType.STRING)
var winterWater: Water,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ class MyPlantServiceTest : DescribeSpec(
"",
Water.MOIST,
Water.MOIST,
Water.MOIST,
Water.MOIST,
100,
100,
Light.MEDIUM,
Expand Down

0 comments on commit bbb5e90

Please sign in to comment.