I’m trying to build an app where I have two kind of users:
Trainers users who have different skills for prepare athletes
And athletes who wants to be prepared for a specific competition
For example an athlete through the application wants to be prepared for sprint 100m competition: he will input that he needs a trainer with a level 10/10 of the skill “reactivity” and a level 5 of the skill “speed”. The app will go through another page and show all the trainers that have reactivity equal to 10/10 and speed skill 5 or more/10. When the athlete make a request of skill level the price is automatically calculated. Let’s say that speed skill worth 5 $ and reactivity 3$
price = ( price of the skill 1 * level of the skill 1) + …+ (price of the skill N* level of the skill N)
so -> (55)+(310) =55
How can I do that ? Which input should I use? And how the data should be structured.
I’m really getting lost, I tried several times but nothing.
Here is the app
This is just a test version of the final app, then I will need to change the input with a Typeform API which will create new things in db and I will add multiple skills
Hope that someone could help me , I wish everyone a nice day
My bubble skills are challenged with this one and I haven’t been able to come up with a simple or elegant solution. Instead, what I have is quite complex and probably very inefficient - so much so that I almost didn’t share it, but a) it does seem to work; b) no one else has answered and c) you appear to be stuck and it may at least give you something to start with.
Anyway, for what it is worth, here is what I’ve done: https://bubble.io/page?type=page&name=skills2&id=louisforum&tab=tabs-1
- User: name (text); type (text) [athlete or trainer]
- Skill: name (text); price (number)
- Skill_Level: trainer (User); skill (Skill); level (number)
- Search_Item: skill (Skill); min_level (number); search_session_id (text)
- Search_Result: search_session_id (text); trainers (listof Users)
- Request: temprequestid (text); trainers (list of Users); tempcost (number); cost (number);
- I created a RG of skills and in each cell, a text field for the skill name and an input field for the level required
- I created a second RG for the results
- The search is the most complicated bit because each result (trainer) must have a skill level greater than or equal to the level requested for each requested skill. Something like this would be easy to do in SQL but not so in Bubble - not for me anyway. If you had a small and finite list of skills then it would be relatively easier, but I assume the list of skills is not small and may be added to in future, so it needs to be dynamic, hence the complexity.
- So when the search is called, I use a combination of custom states, a search session id and an API workflow run on a list to generate the results. Easier to show this than explain it, so see my app link above.
Creating an Actual Request and Calculating the Cost
- I added a button next to each search result, which adds that trainer to the request (creates it if it doesn’t already exist) and triggers a cost update. In this sense a request is like an order, the trainers are order line items and the skill level of the trainer is in effect the quantity.
- As the cost is determined by the requested trainer’s skill levels for each requested skill, I found I had to again use an API workflow on a list to iterate through the trainers and skill_levels to calculate the cost.
- Bubble does not support parentheses in expressions as far as I know, so I had to do the calculation in two steps. Maths.js or the Toolbox plugin could probably make this more simple but I don’t know if they work server-side and didn’t try.
I hope it helps.
This topic was automatically closed after 70 days. New replies are no longer allowed.