hominid4
Member
Below is a simplified version of my Db tables. In short, what is needed is if a user's (`tbl_profiles___attempts` == `tbl_challenge___attempt`) then they are allowed to edit the form as many times they like, but if the user's (`tbl_profiles___attempts` != `tbl_challenge___attempt`) then show a new empty form to create a new row.
I've played with the list's can edit row, and such, but with no luck. Could I get a push in the right direction that may achieve what I'm needing - if it's possible?
tbl_profiles
id | userid | attempts
1 | 356 | 4
2 | 512 | 2
tbl_challenge
id | userid | attempt
1 | 356 | 1
2 | 512 | 1
3 | 356 | 2
4 | 512 | 2
5 | 356 | 3
6 | 356 | 4
"Attempt Challenge" `tbl_challenge` Form Menu Item Settings
Row id: -1
Key name: userid
User 356 has taken the challenge 4 times, user 512 has 2 times.
=======
Long-winded notes if needed:
A user registers for the site to complete a "challenge". When they register, the `tbl_profiles___attempts` is a hidden INT read-only field element and defaults to "1".
The user has X amount of days to submit the challenge form. The challenge form has a hidden read-only `attempt` INT field element that pulls the current `tbl_profiles___attempts` value on form load for that user and populates the submitted challenge row with that user's `tbl_profiles___attempts` value.
The user is able to go back and edit the `tbl_challenge` form as many times as they like within the 100 days, and the `tbl_challenge___attempt` element always uses the user's current `tbl_profiles___attempts` number. That works as needed.
After X amount of days a user first attempts the challenge, we run a cron script that adds +1 to that user's `tbl_profiles___attempts` value. After that, a user can re-take the challenge, so instead of editing an existing `tbl_challenge` row they will be creating a new row with the new +1 `tbl_profiles___attempts` value since (`tbl_profiles___attempts` == `tbl_challenge___attempt`) is FALSE on the first submission of the new challenge.
On a side note, a user is able to see their past submissions `tbl_challenge` list but I've removed the list's "Add" button and they access the `tbl_challenge` form via the "Attempt Challenge" menu item.
Thanks!
Fabrik v3.9.2 latest GitHub
Joomla v3.9.19
I've played with the list's can edit row, and such, but with no luck. Could I get a push in the right direction that may achieve what I'm needing - if it's possible?
tbl_profiles
id | userid | attempts
1 | 356 | 4
2 | 512 | 2
tbl_challenge
id | userid | attempt
1 | 356 | 1
2 | 512 | 1
3 | 356 | 2
4 | 512 | 2
5 | 356 | 3
6 | 356 | 4
"Attempt Challenge" `tbl_challenge` Form Menu Item Settings
Row id: -1
Key name: userid
User 356 has taken the challenge 4 times, user 512 has 2 times.
=======
Long-winded notes if needed:
A user registers for the site to complete a "challenge". When they register, the `tbl_profiles___attempts` is a hidden INT read-only field element and defaults to "1".
The user has X amount of days to submit the challenge form. The challenge form has a hidden read-only `attempt` INT field element that pulls the current `tbl_profiles___attempts` value on form load for that user and populates the submitted challenge row with that user's `tbl_profiles___attempts` value.
The user is able to go back and edit the `tbl_challenge` form as many times as they like within the 100 days, and the `tbl_challenge___attempt` element always uses the user's current `tbl_profiles___attempts` number. That works as needed.
After X amount of days a user first attempts the challenge, we run a cron script that adds +1 to that user's `tbl_profiles___attempts` value. After that, a user can re-take the challenge, so instead of editing an existing `tbl_challenge` row they will be creating a new row with the new +1 `tbl_profiles___attempts` value since (`tbl_profiles___attempts` == `tbl_challenge___attempt`) is FALSE on the first submission of the new challenge.
On a side note, a user is able to see their past submissions `tbl_challenge` list but I've removed the list's "Add" button and they access the `tbl_challenge` form via the "Attempt Challenge" menu item.
Thanks!
Fabrik v3.9.2 latest GitHub
Joomla v3.9.19