Skip to content

Commit

Permalink
Merge pull request #2135 from GiganticMinecraft/fix/getGachaList
Browse files Browse the repository at this point in the history
ガチャの景品データを取得するSQLを修正
  • Loading branch information
Lucky3028 authored Jun 29, 2023
2 parents e108f42 + 407c7b5 commit 8ff3b7d
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ class JdbcGachaPrizeListPersistence[F[_]: Sync, ItemStack: Cloneable](
override def list: F[Vector[GachaPrize[ItemStack]]] = {
Sync[F].delay {
DB.readOnly { implicit session =>
sql"""SELECT gachadata.id, gachadata.probability, gachadata.itemstack, gacha_events.event_name FROM gachadata
| LEFT OUTER JOIN gacha_events ON gachadata.event_id = gacha_events.id
| UNION
| SELECT gachadata.id, gachadata.probability, gachadata.itemstack, gacha_events.event_name FROM gachadata
| RIGHT OUTER JOIN gacha_events ON gachadata.event_id = gacha_events.id"""
sql"SELECT gachadata.id AS gacha_prize_id, probability, itemstack, event_name FROM gachadata INNER JOIN gacha_events ON gachadata.event_id = gacha_events.id"
.stripMargin
.map { rs =>
val probability = rs.double("probability")
Expand All @@ -34,7 +30,7 @@ class JdbcGachaPrizeListPersistence[F[_]: Sync, ItemStack: Cloneable](
itemStack,
GachaProbability(probability),
probability < 0.1,
GachaPrizeId(rs.int("id")),
GachaPrizeId(rs.int("gacha_prize_id")),
rs.stringOpt("event_name").map(GachaEventName)
)
}
Expand Down

0 comments on commit 8ff3b7d

Please sign in to comment.