|
@@ -153,7 +153,10 @@ func buildGames(el element, kind string, windows []offer, keep func(offer) bool,
|
|
|
if !keep(o) {
|
|
if !keep(o) {
|
|
|
continue
|
|
continue
|
|
|
}
|
|
}
|
|
|
- if freeOnly && o.Discount.DiscountPrice != 0 {
|
|
|
|
|
|
|
+ if freeOnly && (o.Discount.DiscountPrice != 0 || o.Discount.DiscountPercentage != 100) {
|
|
|
|
|
+ // DiscountPrice alone is not enough: some offers omit the price
|
|
|
|
|
+ // field (null → 0) while discountPercentage reveals them as
|
|
|
|
|
+ // partial discounts (e.g. Castlevania, Oct 2026).
|
|
|
continue
|
|
continue
|
|
|
}
|
|
}
|
|
|
g := game.Game{
|
|
g := game.Game{
|
|
@@ -171,9 +174,12 @@ func buildGames(el element, kind string, windows []offer, keep func(offer) bool,
|
|
|
}
|
|
}
|
|
|
if o.Discount.DiscountPercentage > 0 && o.Discount.DiscountPercentage < 100 {
|
|
if o.Discount.DiscountPercentage > 0 && o.Discount.DiscountPercentage < 100 {
|
|
|
g.DiscountPct = o.Discount.DiscountPercentage
|
|
g.DiscountPct = o.Discount.DiscountPercentage
|
|
|
- // The API's fmtPrice shows the *original* price; compute the
|
|
|
|
|
- // discounted price display from the discount price (cents).
|
|
|
|
|
- g.FinalPriceFmt = fmt.Sprintf("%d.%02d €", o.Discount.DiscountPrice/100, o.Discount.DiscountPrice%100)
|
|
|
|
|
|
|
+ // discountPercentage here is the *discount* (e.g. 40 = −40 %),
|
|
|
|
|
+ // not the remaining share. discountPrice (cents) may be absent
|
|
|
|
|
+ // (null → 0) on such offers; then show percent only.
|
|
|
|
|
+ if o.Discount.DiscountPrice > 0 {
|
|
|
|
|
+ g.FinalPriceFmt = fmt.Sprintf("%d.%02d €", o.Discount.DiscountPrice/100, o.Discount.DiscountPrice%100)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
if i := indexOfID(games, g.ID); i >= 0 {
|
|
if i := indexOfID(games, g.ID); i >= 0 {
|
|
|
if g.EndDate.After(games[i].EndDate) {
|
|
if g.EndDate.After(games[i].EndDate) {
|