Fix status "modify signup count" code to actually do something

dww - September 19, 2009 - 01:14
Project:Signup Status
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:dww
Status:closed
Description

Since #359411: Add a hook to allow modules to alter the total signup count was never implemented, the UI in the signup_status module to indicate which status values should count towards the signup limit never really worked.

Now that #581734: Improve the signup API: add hook_signup_data_alter(), hook_signup_create(), and hook_signup_update() is done and #581652: Add a {signup_log}.count_towards_limit column and adjust limit logic accordingly is on the way, we can finally fix this in signup_status. Stay tuned for a patch...

#1

dww - September 19, 2009 - 01:14
Status:active» needs review
AttachmentSize
581826-1.signup_status_mod_signup_count.patch 990 bytes

#2

dww - September 19, 2009 - 03:28
Status:needs review» postponed

Committed #1 to HEAD.

However, I just thought of an edge case we need to fix. If an admin changes the "Modifies signup count" value on status values that have existing signups in them, we need to do a potentially heavy operation of updating all the {signup_log} records accordingly. Plus, we need to check the effective signup total vs. the limit on any nodes we touched, so this definitely needs batch API...

So, this would be back to active, but it should be blocked on #581846: Cleanup the signup_status admin UI and provide status weights landing so that we don't touch the admin UI with separate patches...

#3

dww - September 19, 2009 - 18:42
Status:postponed» active

#581846: Cleanup the signup_status admin UI and provide status weights is in, this is active again.

#4

dww - September 19, 2009 - 23:19
Status:active» needs review
AttachmentSize
581826-4.mod_signup_count_batch_update.patch 6.29 KB

#5

dww - September 20, 2009 - 00:53

Rerolled to keep up with HEAD.

AttachmentSize
581826-5.mod_signup_count_batch_update.patch 6.41 KB

#6

dww - September 20, 2009 - 01:13

Now that we've got this function, inside the schema update where signup is adding the {signup_log}.count_towards_limit column, we should invoke this batch-aware function to properly initialize {signup_log}.count_towards_limit on sites that have signup_status and have some status options configured to not modify the signup limit...

I tested this, and setting more batches inside an update.php batch works just fine. Phew. ;)

AttachmentSize
581826-6.signup_schema_update.patch 1.26 KB

#7

dww - September 20, 2009 - 01:32
Status:needs review» needs work

#582250: When you delete a status, signups are left with bogus data made me realize that we also need to deal with some of this batch stuff over there, since it's possible the new status we're reassigning signups to has a different value for mod_signup_count. ;) Fun... I'll see how quick/easy I can reroll this.

#8

dww - September 20, 2009 - 01:54
Status:needs work» needs review

That could have been a lot worse. ;)

AttachmentSize
581826-8.mod_signup_count_change_or_delete_reassign_batch_update.patch 9.35 KB

#9

mlsamuelson - September 20, 2009 - 02:40

The patch applies cleanly.

Any suggestions for how best to test the changes?

#10

dww - September 20, 2009 - 07:49

Suggestions for testing:

a) create some signup-enabled test nodes, and give them some relatively low signup limits (e.g. only 3 slots).

b) define a few different status values that should/shouldn't impact the total, e.g. "yes", "maybe" and "no".

c) signup some dummy users with the different status values, using a few yes/no, and a lot of maybe.

d) visit admin/settings/signup_status, and tweak if "maybe" counts or not. you should see signups open and close on your nodes, assuming the maybes are enough to either push the effective total over/under the limits...

#11

mlsamuelson - September 20, 2009 - 23:49
Status:needs review» reviewed & tested by the community

I setup a test as described. Works slick. I like it.

#12

dww - September 21, 2009 - 03:44
Status:reviewed & tested by the community» fixed

Committed to HEAD. Thanks for the tests!

#13

System Message - October 5, 2009 - 03:50
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.