-
-
Notifications
You must be signed in to change notification settings - Fork 605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic measurements #1560
Comments
First POC: Add a new field to the category to be able to insert python code. That python code is executed in a limited python interpreter in the backend. The example python code attached to the editor as a snippet calculate a new measurement based on another measurement and the weight of that they. dynamic_exercises-2024-01-21_19.46.16.mp4 |
oh, this is nice! Hadn't heard of RestrictedPython before. I also like that we can just define some helper functions like "get_weight_by_date" that would then just be available (but we need to be careful and make sure that we only retrieve the user's data, right now we return any weight entry for that day, but it's just a proof of concept, so it's ok) |
We could also think about saving a couple that most people would find useful and allow the users to just select it (like BMI, 1RM for the big three, etc) BMI = m / height^2 where m is the mass in kg and the height in cm We should also cache the results since depending on what we do, we might have to hit the DB a lot. We can either indefinitely cache this till a new entry is saved or add a new (long lived key) similar to EXERCISE_CACHE_TTL. We can simply cache the whole response like in ExerciseBaseInfoSerializer |
Add the possibility to create dynamic measurements that are calcualted based on other entries. For example, a 1RM calculated value for squats from the logged values or the BMI.
How exactly this would be configured needs to be discussed first, config file, small python module, etc. since we might want some logic there (in the 1RM example, we might only want to take into account sets with 5 reps or less, or just take the entry with the highest weight for a specific day)
The text was updated successfully, but these errors were encountered: