Skip to content

Commit

Permalink
scalafmt
Browse files Browse the repository at this point in the history
  • Loading branch information
outductor committed Feb 18, 2025
1 parent 9063dfd commit acbb6eb
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ class JdbcDonatePersistence[F[_]: Sync] extends DonatePersistence[F] {
obtainedPremiumEffectPoint: Obtained
): F[Unit] = Sync[F].delay {
DB.localTx { implicit session =>
sql"""INSERT INTO donate_purchase_history
sql"""INSERT INTO donate_purchase_history
| (uuid, get_points, timestamp)
| VALUES
| VALUES
| ((SELECT uuid FROM playerdata WHERE name = ${playerName.name}),
| ${obtainedPremiumEffectPoint.effectPoint.value},
| ${obtainedPremiumEffectPoint.purchaseDate})""".stripMargin.execute()
Expand All @@ -48,7 +48,7 @@ class JdbcDonatePersistence[F[_]: Sync] extends DonatePersistence[F] {
sql"""SELECT (
| SELECT COALESCE(SUM(get_points), 0) AS sum_get_points FROM donate_purchase_history
| WHERE uuid = ${uuid.toString}) - (
| SELECT COALESCE(SUM(use_points), 0) AS sum_use_points FROM donate_usage_history
| SELECT COALESCE(SUM(use_points), 0) AS sum_use_points FROM donate_usage_history
| WHERE uuid = ${uuid.toString}) AS currentPremiumEffectPoints
""".stripMargin.map(_.int("currentPremiumEffectPoints")).single()
DonatePremiumEffectPoint(premiumEffectPointsOpt.get)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class JdbcGachaEventPersistence[F[_]: Sync] extends GachaEventPersistence[F] {
override def createGachaEvent(gachaEvent: GachaEvent): F[Unit] =
Sync[F].delay {
DB.localTx { implicit session =>
sql"""INSERT INTO gacha_events
| (event_name, event_start_time, event_end_time) VALUES
sql"""INSERT INTO gacha_events
| (event_name, event_start_time, event_end_time) VALUES
| (${gachaEvent.eventName.name}, ${gachaEvent.startDate}, ${gachaEvent.endDate})
""".stripMargin.execute()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ class JdbcHomePersistence[F[_]: Sync: NonServerThreadContextShift] extends HomeP
NonServerThreadContextShift[F].shift >> Sync[F].delay {
DB.localTx { implicit session =>
// NOTE 2022/04/16: 何故かDB上のIDは1少ない。つまり、ID 1のホームはDB上ではid=0である。
sql"""delete from seichiassist.home
| where server_id = $serverId
| and player_uuid = ${ownerUuid.toString}
sql"""delete from seichiassist.home
| where server_id = $serverId
| and player_uuid = ${ownerUuid.toString}
| and id = ${id.value - 1}""".stripMargin.execute()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class JdbcMineStackObjectPersistence[F[_]: Sync, ItemStack, Player](
Seq(key.toString, objectName, amount)
}

sql"""INSERT INTO mine_stack
| (player_uuid, object_name, amount)
sql"""INSERT INTO mine_stack
| (player_uuid, object_name, amount)
| VALUES (?, ?, ?)
| ON DUPLICATE KEY UPDATE
| amount = VALUES(amount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class JdbcVotePersistence[F[_]: Sync] extends VotePersistence[F] {

override def createPlayerData(uuid: UUID): F[Unit] = Sync[F].delay {
DB.localTx { implicit session =>
sql"""INSERT IGNORE INTO vote
sql"""INSERT IGNORE INTO vote
| (uuid, vote_number, chain_vote_number, effect_point, given_effect_point, last_vote)
| VALUES
| (${uuid.toString}, 0, 0, 0, 0, NULL)""".stripMargin.execute()
Expand Down Expand Up @@ -43,10 +43,10 @@ class JdbcVotePersistence[F[_]: Sync] extends VotePersistence[F] {
NOTE: 最終投票日時より(連続投票許容幅 - 1)した日時よりも
小さかった場合に連続投票を0に戻します。
*/
sql"""UPDATE vote SET chain_vote_number =
sql"""UPDATE vote SET chain_vote_number =
| CASE WHEN DATEDIFF(last_vote, NOW()) <= ${-consecutiveVoteStreakDaysThreshold - 1}
| THEN 0
| ELSE chain_vote_number + 1
| THEN 0
| ELSE chain_vote_number + 1
| END,
| last_vote = NOW()
| WHERE uuid = (SELECT uuid FROM playerdata WHERE uuid = ${uuid.toString})"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class JdbcFairyPersistence[F[_]: Sync] extends FairyPersistence[F] {
override def updateIsFairyUsing(player: UUID, isFairyUsing: Boolean): F[Unit] =
Sync[F].delay {
DB.localTx { implicit session =>
sql"""UPDATE vote_fairy
sql"""UPDATE vote_fairy
| SET is_fairy_using = $isFairyUsing WHERE uuid = ${player.toString}"""
.stripMargin
.execute()
Expand Down Expand Up @@ -150,7 +150,7 @@ class JdbcFairyPersistence[F[_]: Sync] extends FairyPersistence[F] {
DB.readOnly { implicit session =>
sql"""SELECT vote_fairy.uuid AS uuid, name, given_apple_amount,
| RANK() OVER(ORDER BY given_apple_amount DESC) AS rank
| FROM vote_fairy
| FROM vote_fairy
| INNER JOIN playerdata
| ON (playerdata.uuid = vote_fairy.uuid)
| ORDER BY rank"""
Expand Down

0 comments on commit acbb6eb

Please sign in to comment.