How to make an attendance form I specifically hope views can solve my issue.

My views will display the list of students in a specific class and in front of each student's name, I will like to have a button to select whether a student is present or not.

Since this page will be accessed daily(monday-friday), it needs to reset to default everyday but the record must be saved in d database so that we can send the total number of days a student is present in school.

I have tried flag but the issue with the approach is that u can either flag or unflag a user which doesn't allow for daily flaggings.

Could you give me any hint as to what next to try? Do I need to write a module for this?
Modules needed: Flag, Rules, Rules Scheduler (comes bundled with rules)

Create a user flag

Add an integer field to your user fields. Ex: Attendance (this will keep track of the # of days attended)

Create a new Rule


React on A user has been flagged
Actions: Set a data value &gt;&gt; flagged-user:field-user-attendance &gt;&gt; OFFSET : 1

So this will +1 your field every time the user is flagged.


in Rules add a new component.

Component: Rule &gt;&gt; Data Type: User &gt;&gt; Label: att &gt;&gt; Machine Name: att &gt;&gt;
Actions: Unflag a user &gt;&gt; USER: att &gt;&gt; USER ON WHOSE BEHALF TO FLAG: att &gt;&gt; Skip permission check

Go back to your Rule and add action of Schedule Rule Component

Select your component &gt;&gt; SCHEDULED EVALUATION DATE: +5 hours &gt;&gt; Identifier: [flagged-user:name] will be auto unflaged soon &gt;&gt; ATT: flagged-user

so in 5 hours all users that are flagged will be auto unflagged. (this auto resets them for you, so you are ready to flag the next day)

Update

A good solution but the date really needs to get recorded as well – J. Reynolds

Challenge accepted.
In users add a field called &quot;Date Attended&quot; type:text field. In settings Change number of values: Unlimited

In your rule, add Action: Add an item to a list &gt;&gt; flagged-user:field-date-attended &gt;&gt; ITEM TO ADD: click on switch to direct input mode and then put [site:current-date] &gt;&gt; Append item to the end.

This will auto add a new term with a timestamp when you flag a user/student.


You can then use the Field Permissions module if you want to hide this from users so they cant see it and/or edit it.
PS: I think you might know this already, but just in case. To add a flag link to your view, first you need to add a RELATIONSHIP of flag to your view. Then the flag link option will be available to add as a field in fields.
IMPORTANT NOTE: The Scheduled rule will be triggered in the next cron run.