I have a quandary I’ve been trying to solve for over a week now and haven’t yet figured out the solution. I’m hoping to get some advice as to which direction I should be heading or what methods I should use to solve it.
I have a “trivia question of the week” type feature where a new question will display every Monday morning. I cannot for the life of me figure out how to figure out how to change it every Monday and step through the list of questions so that the most recent one pops up on Monday, the previous one goes away, and the next one is queued up.
For each question I have the following fields: asked? (boolean), question_text (text), question_belongs_to (text, to track which company created it), and an asked_date (date). Am I missing some fields to track when it should appear?
Any pointing in the right direction would be super helpful.
Can you do something simple like assign the date when it should post and then just do a conditional statement to display if that date equals current date? If you want to keep it up the whole week you can just say if date is between that date and that date +6 or +7 days or something like that. Then just display the first item in the list? Would that work?
If you are on a paid plan (personal or above), you can implement a recurring workflow that has a weekly cadence. (Note: I’m assuming that you create unique question entries in the database for each user, not using a common/shared list across all users. But the general logic should point you in the right direction).
When that workflow runs, you can use it to set a list for the user, which would be a list comprised of the new question to ask merged with all of the other questions to display in the list (derived from a search to meets your constraints). (So, the first item in the list would be the featured question, followed by all others). As a bonus, you can also use it to send a notification to the user.
For another approach, you could place a boolean field on the questions that indicated is_featured = yes for the top question, and no for all of the other questions. Then, you sort the list by is_featured = yes.