Skip to content

Commit

Permalink
Fix active coupon not showing up in the coin flip bet response
Browse files Browse the repository at this point in the history
This must be refactored later because it is very wonky
  • Loading branch information
MrPowerGamerBR committed Oct 30, 2024
1 parent 8477866 commit b913e6c
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import net.dv8tion.jda.api.interactions.IntegrationType
import net.dv8tion.jda.api.interactions.InteractionContextType
import net.dv8tion.jda.api.interactions.components.buttons.Button
import net.dv8tion.jda.api.interactions.components.buttons.ButtonStyle
import net.dv8tion.jda.api.utils.TimeFormat
import net.perfectdreams.loritta.cinnamon.discord.interactions.commands.styled
import net.perfectdreams.loritta.cinnamon.discord.utils.SonhosUtils
import net.perfectdreams.loritta.cinnamon.discord.utils.SonhosUtils.appendCouponSonhosBundleUpsellInformationIfNotNull
Expand All @@ -32,7 +31,6 @@ import net.perfectdreams.loritta.morenitta.interactions.commands.options.Applica
import net.perfectdreams.loritta.morenitta.interactions.commands.options.OptionReference
import net.perfectdreams.loritta.morenitta.utils.*
import net.perfectdreams.loritta.morenitta.utils.extensions.refreshInDeferredTransaction
import net.perfectdreams.loritta.morenitta.utils.extensions.toJDA
import net.perfectdreams.loritta.morenitta.website.routes.user.dashboard.ClaimedWebsiteCoupon
import net.perfectdreams.loritta.serializable.SonhosPaymentReason
import net.perfectdreams.loritta.serializable.StoredCoinFlipBetTransaction
Expand Down Expand Up @@ -519,7 +517,6 @@ class CoinFlipBetCommand(val loritta: LorittaBot) : SlashCommandDeclarationWrapp
?.get(AprilFoolsCoinFlipBugs.bug)
}


val couponData = WebsiteDiscountCoupons.selectAll()
.where {
WebsiteDiscountCoupons.public and (WebsiteDiscountCoupons.startsAt lessEq now and (WebsiteDiscountCoupons.endsAt greaterEq now))
Expand All @@ -534,15 +531,15 @@ class CoinFlipBetCommand(val loritta: LorittaBot) : SlashCommandDeclarationWrapp
}
.count()

ClaimedWebsiteCoupon(
activeCoupon = ClaimedWebsiteCoupon(
couponData[WebsiteDiscountCoupons.id].value,
couponData[WebsiteDiscountCoupons.code],
couponData[WebsiteDiscountCoupons.endsAt],
couponData[WebsiteDiscountCoupons.total],
couponData[WebsiteDiscountCoupons.maxUses],
paymentsThatUsedTheCouponCount,
)
} else null
}
}
} else {
winner = invitedUser
Expand Down Expand Up @@ -611,15 +608,15 @@ class CoinFlipBetCommand(val loritta: LorittaBot) : SlashCommandDeclarationWrapp
}
.count()

ClaimedWebsiteCoupon(
activeCoupon = ClaimedWebsiteCoupon(
couponData[WebsiteDiscountCoupons.id].value,
couponData[WebsiteDiscountCoupons.code],
couponData[WebsiteDiscountCoupons.endsAt],
couponData[WebsiteDiscountCoupons.total],
couponData[WebsiteDiscountCoupons.maxUses],
paymentsThatUsedTheCouponCount,
)
} else null
}
}
}

Expand Down

0 comments on commit b913e6c

Please sign in to comment.