wavesinaroom / my_odin_project_food_for_thought

Django backend applications that takes care of your nutrition and your mind
1 stars 0 forks source link

Reward #12

Closed wavesinaroom closed 5 months ago

wavesinaroom commented 7 months ago

Once users have answered a question correctly, they choose a reward from a list of options that matches the question level reward from the question component to be stored in a single instance of a database model.

There's an additional reward that is automatically unlocked and stored in the database as a gift for a group of five right answers a user has. Such reward is a random fetched result from boredb that is notified on users' screen.

Ideally, there is a search filter that help users filter out an option they might want to choose right away. Implementing it may need regular expressions and extra time that will make this component longer to finish so this feature is optional and can be excluded.

Users can take another question or being redirected to the journal component to plan a day with any of their rewards stored in their logs.

Tasks

Routing

Requests are made to a single url: log/reward

Database

There must to only one log model instance per user and it should contain the following fields:

View

The reward component view fetches data to render the rewards list and checks users' strikes.

Template

Renders content dynamically but it can filter out reward options for users if that feature is included.

Tests

wavesinaroom commented 6 months ago

There are over 600 ingredientes in our mealdb API. I think there are fewer areas and just a few categories. The problem with the ingredients mainly is that no one will be pleased to scroll down that far to search for the ingredient they want to choose. So, I need to create a filter that help users to find their choice much quicker. On the other hand items users have already picked must be excluded from the list to avoid duplicates.

wavesinaroom commented 6 months ago

I learned a bit about list comprehensions and tuples by converting the API fetched into tuples I could render in a form. However, I feel that working on a filter can take a lot of time and I've already spent a lot of it in the project so far, not that I'm unhappy with the process but I'd rather move forward, there's still a lot to do ahead. What's the solution? Users will get random rewards and I'll make sure that there are not duplicates in the database.

wavesinaroom commented 6 months ago

I'm going back to the idea of users choosing their rewards. For ingredients in this case, I'll take random chunks from the long list fetched from the API, that way users won't need to scroll down forever to get the ingredient they're looking for. Update in issue description will be deleted now.

wavesinaroom commented 5 months ago

JSON fields aren't good for store data in this case because users just add their rewards to a database. So, I'm gonna change the model fields to hold a list instead

wavesinaroom commented 5 months ago

Special characters such as single quote mark hacks rewards filtering. This isn't a huge problem so I'll move on and come back to it if it is critical.

wavesinaroom commented 5 months ago

Activity feature is ready and tested