I’m trying to solve a problem for a client.
It’s a language school.
They have, courses so I have a Courses model and table.
Each course has a name and a description and a price_per_week field (a
base price if you like).All is fine, or should I say, was fine.The
client now wants to charge different prices depending on the length of
the students course.
1-2 weeks - price_per_week * 1.0
3-4 weeks - price_per_week * 0.9
5-6 weeks - price_per_week * 0.8
7-8 weeks - price_per_week * 0.7
8 weeks+ - price_per_week * 0.6
My plan is to do the following,
Introduce a Discounts model.
I’ll fill it with the five time periods above.
I presume I need in my Courses model
and in Discounts
If my plans basically correct, can someone give me an example of how I
would then render a table of prices by period in a view. I’m thinking of
using a partial for this if possible so I can put price tables up for a
particular course where I need them?