-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
jekuaitk
commented
Aug 26, 2024
•
edited
Loading
edited
- Keeps total donation count and duration in state
- Updates state when a new donation is made
- Disables cache on front-page
677b014
to
4b377c1
Compare
f89b628
to
54ab259
Compare
$this->helper->updateTotalDonationDuration((int) $request->request->get('duration')); | ||
$this->helper->updateTotalNumberOfDonations(); |
There was a problem hiding this comment.
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?
Co-authored-by: Mikkel Ricky <[email protected]>
Co-authored-by: Mikkel Ricky <[email protected]>
$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); |
There was a problem hiding this comment.
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.
// Attempt acquiring lock, wait if failed. | ||
// @see https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Lock%21LockBackendInterface.php/group/lock/11.x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! 🎉