From 5515ad070422daf3de84ed6a4547876633099fd1 Mon Sep 17 00:00:00 2001 From: Fernando Takagi Date: Thu, 26 Oct 2023 11:27:15 -0300 Subject: [PATCH] Update core_purchase.go --- server/core_purchase.go | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/server/core_purchase.go b/server/core_purchase.go index 20a53567c8..744ad6c09a 100644 --- a/server/core_purchase.go +++ b/server/core_purchase.go @@ -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) @@ -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)