Updating a CCK field globally, on a schedule

Events happening in the community are now at Drupal community events on www.drupal.org.
narayanis's picture

I'm wondering if Rules is a good solution for the following scenario:

  1. Users log volunteer time on a regular basis (a content type with CCK field for date and hours worked).
  2. Once a week, a content profile field (last_checked_total, initially at 0) is checked against the current sum of hours worked.
  3. If the difference in the current total and last_checked_total is over 8, the user is added to a list which will be emailed; this is used for giving out awards.
  4. After the list is created and the email sent, last_checked_total is updated to be the current total (to prevent emails from being sent multiple times).

I'm not sure if Rules is the right way to go or not, because I have to find all records that exceed the threshold, create a report or list of these records along with how much they exceeded the threshold (a jump from 8 to 24 hours logged gets two awards, while 8 to 16 gets one award). Most of this would make sense as a rule, but it's the list creation that's throwing me.

Comments

Try using Views Bulk

barckhoff's picture

Try using Views Bulk Operations. I think you'd need to create a view that is filtered on the volunteer's minimum number of hours to meet this criteria. You can use VBO to email this list of volunteers in the view. You can also edit node fields of the volunteers in this view. You should be also be able to run these from scheduled rule sets.

I looked at VBO, but I'm not

narayanis's picture

I looked at VBO, but I'm not sure if it will meet the need because I can't seem to get the data in a view. The report to be emailed to the manager is a list of users and the results of a formula (if new hours mod 8 - old hours mod 8 >= 1 then include user and result of calculation). I can then run a cron job or a scheduled rule to globally update last_checked_value (content profile field) for all users who met the formula criteria.

The SQL to find these users and create the list is easy to write manually; I'm starting to look at BIRT as an option to generate and email the report.

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: