Background (simplified)
We're collecting data for a study in which participants come in on several occasions to have health measures taken. We have two custom node types: Participant
stores background data about a person, and Visit
stores information from a single visit (e.g., their blood pressure that day). Each Visit is related to one Participant via a field created by the Node References module.
On each visit, a participant might qualify for a one-time reward. Visit nodes have a reward_visit
field indicating whether the participant earned a reward on this visit, and Participant nodes have a reward_ever
field indicating whether the participant has ever received a reward.
Question
I'd like to set up the following behavior: If a Visit node is created where reward_visit
was set to Yes, also set reward_ever
to Yes in the corresponding Participant node.
Is there a way to make this happen automatically, using Node References or some other relations module? I could custom-code it using hook_node_insert() or something, but I'd like to know if there's already an accepted way.