Duration-Based Tiers
Configure different budgets and cabin classes based on flight duration
Duration-Based Tiers
Duration-based tiers allow you to set different budget limits and cabin class allowances based on how long a flight is. This provides flexibility for long-haul travel where prices are naturally higher and comfort matters more.
Why Use Duration Tiers?
Without duration tiers, you face a trade-off:
- Set a low budget → Long flights always violate policy
- Set a high budget → Short flights have too much slack
Duration tiers solve this by allowing context-aware limits.
Budget Tiers
Budget tiers set different maximum prices based on flight duration.
Configuration
Each tier defines:
- Min Hours: Start of the duration range (inclusive)
- Max Hours: End of the duration range (exclusive, or null for unlimited)
- Max Price: Budget limit for this range
Example
| Min Hours | Max Hours | Max Budget |
|---|---|---|
| 0 | 3 | $450 |
| 3 | 7 | $650 |
| 7 | null | $1,000 |
How Evaluation Works
Backend Logic (from policy-evaluation.service.ts):
- Get flight duration in hours
- Iterate through tiers in order
- Find first tier where:
duration >= minHours AND (maxHours is null OR duration < maxHours) - Use that tier's
maxPrice - If no tier matches, use rule's base
maxPricePerPerson
Tier Gaps
If your tiers don't cover all durations, the base budget is used as fallback:
| Min Hours | Max Hours | Max Budget |
|---|---|---|
| 0 | 4 | $400 |
| 8 | null | $1,000 |
4-7 hour flight: No tier matches → Uses base maxPricePerPerson (e.g., $600)
Avoid gaps in tier ranges. Ensure tiers cover from 0 to unlimited for predictable behavior.
Cabin Tiers
Cabin tiers allow different cabin classes based on flight duration — typically allowing upgrades for longer flights.
Configuration
Each tier defines:
- Min Hours: Start of the duration range (inclusive)
- Max Hours: End of the duration range (exclusive, or null for unlimited)
- Allowed Classes: List of permitted cabin classes
Example
| Min Hours | Max Hours | Allowed Classes |
|---|---|---|
| 0 | 5 | Economy |
| 5 | 10 | Economy, Premium Economy |
| 10 | null | Economy, Premium Economy, Business |
How Evaluation Works
Backend Logic (from policy-evaluation.service.ts):
- Get flight duration in hours
- Iterate through tiers in order
- Find matching tier (same logic as budget tiers)
- Use that tier's
classesarray - If no tier matches, use rule's base
allowedCabinClasses - Check if selected cabin class is in the allowed list
Combined Tier Example
A comprehensive long-haul rule might use both tiers:
Route: All international flights
Budget Tiers:
| Duration | Budget |
|---|---|
| 0-4 hours | $500 |
| 4-8 hours | $800 |
| 8-12 hours | $1,200 |
| 12+ hours | $1,800 |
Cabin Tiers:
| Duration | Classes |
|---|---|
| 0-6 hours | Economy |
| 6-10 hours | Economy, Premium |
| 10+ hours | Economy, Premium, Business |
Evaluation for a 9-hour flight at $1,000 in Premium Economy:
- Budget: 4-8 hour tier = $800 → $1,000 > $800 = Price violation
- Cabin: 6-10 hour tier = Economy/Premium → Premium is allowed = No violation
Best Practices
1. Cover All Durations
Ensure tiers span from 0 to unlimited:
0-4, 4-8, 8-12, 12+ (null)Not:
2-4, 6-8, 10+ (gap at 0-2, 4-6, 8-10)2. Match Budget Tiers to Market Rates
Research actual flight prices for different durations:
| Duration | Typical Price Range | Suggested Tier |
|---|---|---|
| < 3 hours | $200-500 | $400-500 |
| 3-6 hours | $400-800 | $600-700 |
| 6-10 hours | $700-1,200 | $900-1,100 |
| 10+ hours | $1,000-2,500 | $1,500-2,000 |
3. Align Cabin Tiers with Comfort Needs
Consider employee well-being:
| Flight Type | Duration | Suggested Classes |
|---|---|---|
| Short domestic | < 3 hours | Economy only |
| Regional | 3-6 hours | Economy, maybe Premium |
| Medium-haul | 6-10 hours | Economy, Premium |
| Long-haul | 10+ hours | Economy, Premium, Business |
| Ultra long | 14+ hours | Consider Business as default |
4. Test Your Tiers
Before deploying, test various scenarios:
- Short domestic flight ($300, Economy)
- Medium regional flight ($600, Premium)
- Long international flight ($1,200, Business)
- Edge cases at tier boundaries (exactly 4 hours, 8 hours, etc.)
Troubleshooting
Wrong tier applied
Symptom: Flight uses unexpected budget/cabin limit
Cause: Tier boundaries not aligned or gaps exist
Solution: Review tier configuration; ensure no gaps; verify minHours/maxHours boundaries
Duration not detected
Symptom: Always uses base budget, not tiers
Cause: Flight duration not provided in booking data
Solution: Ensure booking integration sends durationHours field
Tier not saving
Symptom: Tier configuration lost after save
Cause: Invalid tier format or validation error
Solution: Check for required fields; ensure tiers don't overlap