Problem/Motivation

Using computed fields for the availability, registration and waitlist counts is arguably a cleaner, centralised and more Drupal-y way of accessing these dynamic properties for an event instance.

Proposed resolution

Patch attached moves calculation of the properties to computed field plugins in the recurring_events_registration module. It uses the computed_field_plugin module to provide some convenient traits to make the classes definitions more compact.

The views integration is achieved by simply returning the value of the computed fields.

Remaining tasks

Use the computed fields in RegistrantForm as well.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bgilhome created an issue. See original summary.

owenbush’s picture

This is a nice idea. Thank you for raising the issue and providing the code. I'll take a look at it to review.

owenbush’s picture

@bgilhome, I have created an MR from your patch, and added in the changed to RegistrantForm. It seems to be working for me. I like this idea so much that I may actually steal the idea and use it with the main module.

owenbush’s picture

I have updated the MR to remove the need for the computed_field_plugin, it didn't really provide much that the core ComputedItemListTrait didn't.

  • owenbush committed 8f2eb15 on 2.0.x
    Issue #3264621 by owenbush, bgilhome: Use computed fields for...

  • owenbush committed 127a981 on 8.x-1.x
    Issue #3264621 by owenbush, bgilhome: Use computed fields for...
owenbush’s picture

Status: Needs review » Fixed

This has been merged into the 8.x-1.x and 2.0.x dev branches.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.