arrow_back_iosQuestions
help

# What if there are discounts at different times?

check_circle
We admit at an institution such quotations:
• The usual rate is \$100.
• Every day from 14:00 to 17:00 - \$80.
• Discount on Thursday - 20%, in other days - 10%.
First, you need to determine how to properly split the calendar time into parts. If any reservation parameter is different in time, you need to create a separate rule.
In our case, we will break the calendar into such rules of work:
• Thursday: 2:00 PM to 5:00 PM.
• Thursday.
• Weekdays: 2:00 PM to 5:00 PM.
• Weekdays
• Always: 2:00 PM to 5:00 PM.
• Always.
Rules should be placed on priorities. To narrow the gap covered wide.
Now we run through all the components of the price for each rule of work. It is necessary to include only those discounts that operate on this interval. In the end, this configuration will be:
Each new discount multiplies by 2 the number of rules of work that it crosses. If we want to add an additional 5% discount for the whole of July, then we need to duplicate the rules. As a result, you get the following rules:
• Thursday, July: 2:00 PM to 5:00 PM.
• Thursday, July.
• Weekdays, July: 2:00 PM to 5:00 PM.
• Weekdays, July.
• Always, July: 2:00 PM to 5:00 PM.
• Always, July.
• Thursday: 2:00 PM to 5:00 PM.
• Thursday.
• Weekdays: 2:00 PM to 5:00 PM.
• Weekdays.
• Always: 2:00 PM to 5:00 PM.
• Always.