Skip to content
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

Feature/donation count and duration state #24

Merged
merged 12 commits into from
Aug 27, 2024

Conversation

jekuaitk
Copy link
Contributor

@jekuaitk jekuaitk commented Aug 26, 2024

  • Keeps total donation count and duration in state
  • Updates state when a new donation is made
  • Disables cache on front-page

@jekuaitk jekuaitk force-pushed the feature/donation-count-and-duration-state branch from 677b014 to 4b377c1 Compare August 26, 2024 10:31
@jekuaitk jekuaitk force-pushed the feature/donation-count-and-duration-state branch from f89b628 to 54ab259 Compare August 26, 2024 12:21
@jekuaitk jekuaitk marked this pull request as ready for review August 26, 2024 12:24
@jekuaitk jekuaitk requested a review from rimi-itk August 26, 2024 12:30
Comment on lines +276 to +277
$this->helper->updateTotalDonationDuration((int) $request->request->get('duration'));
$this->helper->updateTotalNumberOfDonations();
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you throwing away metadata here? Why?

@jekuaitk jekuaitk requested a review from rimi-itk August 27, 2024 06:59
Comment on lines 107 to 109
$currentTotal = $this->getTotalNumberOfDonations();

if (is_null($currentTotal)) {
$this->state->set(self::GIV_DIN_STEMME_DONATION_COUNT_STATE_KEY, 1);
}
else {
$this->state->set(self::GIV_DIN_STEMME_DONATION_COUNT_STATE_KEY, $currentTotal + 1);
}
$this->state->set(self::GIV_DIN_STEMME_DONATION_COUNT_STATE_KEY, ($currentTotal ?? 0) + 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Handle this like you handle the total above.

Comment on lines +118 to +119
// Attempt acquiring lock, wait if failed.
// @see https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Lock%21LockBackendInterface.php/group/lock/11.x
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you! 🎉

@jekuaitk jekuaitk requested a review from rimi-itk August 27, 2024 08:13
@jekuaitk jekuaitk merged commit e9f80a5 into develop Aug 27, 2024
8 checks passed
@jekuaitk jekuaitk deleted the feature/donation-count-and-duration-state branch August 27, 2024 11:11
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