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

Shop offers weren't properly inserted #3

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions misc/update_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,18 +223,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
Loading