StatisticalReinforcementLearningLab / SARAv2

SARA V2
BSD 3-Clause "New" or "Revised" License
5 stars 2 forks source link

restricting users to fill out daily survey only once #221

Open euranofshin opened 3 years ago

euranofshin commented 3 years ago

Currently, users in our version of the app are able to take the survey as many times as they want in a day. We want to restrict this to let them fill it out daily. The original version of the app made the survey unavailable once they filled it out.

Acceptance criteria:

sarahrathnam commented 3 years ago

Based on the surveyCompleted() method here

https://github.com/StatisticalReinforcementLearningLab/SARAv2/blob/2da811d27da22f87ee1befc83b7862d4e12f6599/dist/out-tsc/src/app/user/user-profile/user-profile.service.js#L282

it looks like the info about whether the survey was Completed comes from the user registration microservice, either '/userinfo' or '/userinfofixed'.

In the user registration microservice, I see a couple of potential issues:

Let me know if I'm on the right track or going down a rabbit hole here. Thanks!

mashfiqui-rabbi commented 3 years ago

Sarah, Look at the logic in this function: https://github.com/StatisticalReinforcementLearningLab/SARAv2/blob/d44254095555f9f04d3902ba82fdb1a9a5a92b5b/src/app/incentive/aquarium/aquarium.component.ts#L269

If we replicate the logic for the current survey, it will lock the survey between midnight to 6 pm and if the survey is already taken for the day.

sarahrathnam commented 3 years ago

This is great, thank you!