I have a content type I created for a weekly contest setup to pick the winner at the end of each week from a view of images sorted by votes. Everything works great except I can't seem to setup a rule to create a new contest when the current one is completed. The rule is setup such that on contest completion when the node type is the contest node for the weekly contest, create a new weekly contest node with beginning and end dates accordingly. Nothing gets created though and there are no errors or log entries. I'm wondering if this is the way I'm suppose to setup repeats or if the filter on the contest node type isn't working?

Comments

vinoth.3v’s picture

Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

Please debug the rule by enabling the display of rules debug as messges. and create a dummy rule to create a new contest when viewing a contest node (jsut for test) so you can see the rules debug messages and which rule action is giving False result.

please confirm this and let me know if it is not working.

ralva83638’s picture

I get 2 errors in the report log when setting the rule to react on when content is viewed and type is weekly contest, and I can't view the content:

Notice: Trying to get property of non-object in simple_contest_rules_action_create_new_contest() (line 212 of /var/www/drupal-7.12/sites/all/modules/simple_contest/modules/simple_contest_rules/simple_contest_rules.rules.inc).

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'last_comment_uid' cannot be null: INSERT INTO {node_comment_statistics} (nid, cid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5); Array ( [:db_insert_placeholder_0] => 122 [:db_insert_placeholder_1] => 0 [:db_insert_placeholder_2] => 1333642357 [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => [:db_insert_placeholder_5] => 0 ) in comment_node_insert() (line 1301 of /var/www/drupal-7.12/modules/comment/comment.module).

ralva83638’s picture

So I changed line 212 to:

$node->uid = 1;//$node_user->uid;

and it worked. In the form for create new contest I had that field set to 0. Can you confirm that my original setup was correct, on contest complete, I need to know what the filter type I should use, right now I use "content if of type", data selector is contest, and in the select list I choose my weekly contest type? Thank you.

vinoth.3v’s picture

Thank you Ralva for the bug report. I will fix that.
and yes your setup is correct. FYI, you can also use the "simple contest repeat" submodule to schedule the contest ceation.

ralva83638’s picture

I tried again after fixing the bug and the contest completed and a new one was not created, this time all reporting was on and there wasn't a log entry saying a rule was triggered. I'll try the repeat module next.