Skip to content

Conversation

@Nandgopal-R
Copy link
Member

No description provided.


q := db.New()

email, err := q.GetEmailByTxnId(ctx, tx, req.TxnID)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Club booking details fetching and email fetching into single query using Common Table Expression or sub-queries in SQL and return the data together.


q := db.New()

email, err := q.GetEmailByTxnId(ctx, tx, req.TxnID)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, same issue. Club the email and booking details in same query. Reduce DB calls on hot paths.

return
}

// Only reverifying failed transactions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the nesting!! Do if booking.TxnStatus != models.PaymentFailed then return back with no action taken and a corresponding HTTP status code.

// if still failed
if gatewayStatus == models.PaymentFailed || gatewayStatus == models.PaymentNotFound {
// Restore released seats and close dispute
disputeId, err := q.GetDisputeIdFromTxnIdQuery(ctx, tx, req.TxnID)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why to get dispute and then close the dispute. Just mark the dispute given the transaction id which is OPEN as CLOSED ?

// if payment is success
if gatewayStatus == models.PaymentSuccess {
// Closing the dispute as valid payment
disputeId, err := q.GetDisputeIdFromTxnIdQuery(ctx, tx, req.TxnID)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't close as True dispute just work on transaction ID ? Anyways, we are not allowing multiple dispute creation if one dispute for given transaction ID is open right ?

@@ -0,0 +1,74 @@
-- +goose Up
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you have changed the materialized view here and it's name. Have you informed @Naganathan05 about it ? Please make sure that the materialized view changes are in sync or they are dropped from this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nandgopal-R
Does this change introduce any new field to the view. If so can you just mention it so that I can include that in the upcoming analytics PR which is almost done. This change can be dropped from this PR in my opinion.

}
}
} else {
teamId, err := q.GetTeamIDByBooking(ctx, tx, booking.ID)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need teamId to come back into the controller. You only need teamMembers's studentIDs right ? Use a subquery or CTE and do it.

@IAmRiteshKoushik
Copy link
Member

@Nandgopal-R do you want to fix these or just close the PR ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants