Skip to content

PM-1206 - reset payment status #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2025
Merged

PM-1206 - reset payment status #59

merged 1 commit into from
May 21, 2025

Conversation

vas3a
Copy link
Collaborator

@vas3a vas3a commented May 20, 2025

https://topcoder.atlassian.net/browse/PM-1206 - Reset payment status for Owed/Available payments

@vas3a vas3a requested a review from kkartunov May 20, 2025 07:14

UPDATE payment
SET payment_status = 'ON_HOLD'
WHERE winnings_id IN (

Choose a reason for hiding this comment

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

medium
performance
The subquery in the WHERE clause could potentially lead to performance issues if the winnings table is large. Consider using an EXISTS clause instead of IN to improve performance by stopping at the first match.

FROM winnings
LEFT JOIN trolley_recipient ON winnings.winner_id = trolley_recipient.user_id
LEFT JOIN trolley_recipient_payment_method ON trolley_recipient.id = trolley_recipient_payment_method.trolley_recipient_id
WHERE payment.payment_status = 'OWED' AND (

Choose a reason for hiding this comment

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

high
correctness
Ensure that the payment table is correctly joined with the winnings table. The current query assumes that winnings_id in the payment table directly corresponds to winning_id in the winnings table, which might not be the case if there are any discrepancies or missing foreign key constraints.

LEFT JOIN trolley_recipient ON winnings.winner_id = trolley_recipient.user_id
LEFT JOIN trolley_recipient_payment_method ON trolley_recipient.id = trolley_recipient_payment_method.trolley_recipient_id
WHERE payment.payment_status = 'OWED' AND (
trolley_recipient.trolley_id IS NULL OR
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we please remove this?
Sorry, had to mention this in AC, but realized we could have trolley_id records pre-created for members when we import offline data. So we want to target members without trolley_recipient_payment_method set.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is cleared in Slack.

@kkartunov kkartunov self-requested a review May 20, 2025 09:16
LEFT JOIN trolley_recipient ON winnings.winner_id = trolley_recipient.user_id
LEFT JOIN trolley_recipient_payment_method ON trolley_recipient.id = trolley_recipient_payment_method.trolley_recipient_id
WHERE payment.payment_status = 'OWED' AND (
trolley_recipient.trolley_id IS NULL OR
Copy link
Contributor

Choose a reason for hiding this comment

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

This is cleared in Slack.

@vas3a vas3a merged commit 86c1b99 into dev May 21, 2025
1 check passed
@vas3a vas3a deleted the PM-1206_reset-payment-status branch May 21, 2025 06:32
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.

2 participants