Closed KateCourt closed 2 years ago
Should we also use this function to say if it has been over a year (and therefore participation is ended)?
The above relies on the date associated with the weekly form being the date it applies to (start of week) rather than the date it was submitted, so the app needs to know what date each form is due on even if the user fills it in a few days late. Given this, I've got an adjusted suggestion:
{ showWeeklyForms: true/false, lastWeekSubmittedEnds: string, startWeeklyFormsDate: string }
startWeeklyFormsDate + 7
showWeeklyForms
is true, app should display weekly forms. lastWeekSubmittedEnds
should be used to work out if the user should be given the option to enter a new weekly form or not, and to be used to calculate what the date field of any forms they submit should be. Note: unlike presently where date refers date submitted, we would need to change this to refer to what date the weeks ends that the form refers to. So if '2022-05-04' is returned, the app knows that the 'add form' button should not be displayed until 2022-05-11. If a date older than 7 days previously is displayed then the user has missed a week and so perhaps this should be shown as an option to catch up. This assumes that once they are a full week late they cannot submit a late form - we could change this if needed.Created a callable function.
Details of how to call function from Flutter: https://firebase.google.com/docs/functions/callable#call_the_function
Use something like this:
var childDetails = firebase.functions().httpsCallable('checkChild'); childDetails({child_id: string}).then((result)=> { console.log(result); }).catch((error)=> { console.log(error); })
Working in the latest version on Dev. Will add any bugs as separate issues.
{ showWeeklyForms: true/false, startOfWeek: 0-6, lastWeekSubmitted: true/false }
showWeeklyForms
is true, app should display weekly forms. In addition, iflastWeekSubmitted
is false, then display button to add a new weekly form and display message along the lines of 'Please let us know about the 7 days prior to [startOfWeek
]'. Else display daily forms as normal.