Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3 from ggmolly/fix/shop-offers-import
Browse files Browse the repository at this point in the history
Shop offers weren't properly inserted
  • Loading branch information
Molly authored Apr 15, 2024
2 parents 2918358 + 4ac1bb7 commit 30a8184
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions misc/update_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,16 @@ func importShopOffers(region string, tx *gorm.DB) error {
for decoder.More() {
var offer struct { // decoding to json via a pq.Int64Array is not supported, so we need to decode the effects manually
orm.ShopOffer
Effects_ []uint32 `json:"effects" gorm:"-"`
Effects_ []uint32 `json:"effect_args" gorm:"-"`
}
if err := decoder.Decode(&offer); err != nil {
return err
}

// Manually convert the effects to pq.Int64Array
offer.ShopOffer.Effects = make([]int64, len(offer.Effects_))
for i, effect := range offer.Effects_ {
offer.ShopOffer.Effects[i] = int64(effect)
}

shopOffer := orm.ShopOffer{
ID: offer.ID,
Effects: offer.Effects,
Expand Down

0 comments on commit 30a8184

Please sign in to comment.