Skip to content

Commit

Permalink
Update core_purchase.go
Browse files Browse the repository at this point in the history
  • Loading branch information
ftkg committed Oct 26, 2023
1 parent 9c48db9 commit 5515ad0
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions server/core_purchase.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ func upsertPurchases(ctx context.Context, db *sql.DB, purchases []*storagePurcha
purchase.rawResponse = "{}"
}
transactionIDsToPurchase[purchase.transactionId] = purchase

userIdParams = append(userIdParams, purchase.userID)
storeParams = append(storeParams, purchase.store)
transactionIdParams = append(transactionIdParams, purchase.transactionId)
Expand Down Expand Up @@ -641,32 +641,6 @@ RETURNING
return nil, err
}

//if err := ExecuteInTxPgx(ctx, db, func(tx pgx.Tx) error {
// br := tx.SendBatch(ctx, batch)
// defer br.Close()
// for range purchases {
// // Newly inserted purchases
// var dbUserID uuid.UUID
// var transactionId string
// var createTime pgtype.Timestamptz
// var updateTime pgtype.Timestamptz
// var refundTime pgtype.Timestamptz
// if err := br.QueryRow().Scan(&dbUserID, &transactionId, &createTime, &updateTime, &refundTime); err != nil {
// return err
// }
// storedPurchase := transactionIDsToPurchase[transactionId]
// storedPurchase.createTime = createTime.Time
// storedPurchase.updateTime = updateTime.Time
// storedPurchase.seenBefore = updateTime.Time.After(createTime.Time)
// if refundTime.Time.Unix() != 0 {
// storedPurchase.refundTime = refundTime.Time
// }
// }
// return br.Close()
//}); err != nil {
// return nil, err
//}

storedPurchases := make([]*storagePurchase, 0, len(transactionIDsToPurchase))
for _, purchase := range transactionIDsToPurchase {
storedPurchases = append(storedPurchases, purchase)
Expand Down

0 comments on commit 5515ad0

Please sign in to comment.