From 6cd7903555c78fe8e71a440e7eea5052233a6b74 Mon Sep 17 00:00:00 2001 From: Joe Arriaga Date: Sat, 2 Mar 2019 20:37:38 -0800 Subject: [PATCH 1/4] Added economy class check to policy.py file. --- back/backend/policy.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/back/backend/policy.py b/back/backend/policy.py index 41f8b73..b143304 100644 --- a/back/backend/policy.py +++ b/back/backend/policy.py @@ -97,6 +97,7 @@ planning_section = Section( "preferred_flight_fare": {"number": 6, "label": "Fare of your preferred flight", "field_type": "decimal"}, "preferred_flight_duration": {"number": 7, "label": "Flight duration of your preferred flight (hours)", "field_type": "decimal"}, "international_flight": {"number": 8, "label": "Is this an international flight?", "field_type": "boolean"}, + "economy_class": {"number": 9, "label": "Is your ticket in economy/coach?", "field_type": "boolea n"}, } ) @@ -142,6 +143,12 @@ def departure_date_limit_rule(report, fields): return None planning_section.add_rule(title="Departure date limit", rule=departure_date_limit_rule) + +def economy_class_rule(report, fields): + if not economy_class: + return "Only economy or coach class tickets are within policy." + +planning_section.add_rule(title="Economy class check", rule=economy_class_rule) pol.add_section(planning_section) #### Flight Info From f2943e1d6978410beab953cd0227ab17d4d9dc72 Mon Sep 17 00:00:00 2001 From: joe-arriaga Date: Wed, 6 Mar 2019 09:50:52 -0800 Subject: [PATCH 2/4] Update policy.py --- back/backend/policy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/back/backend/policy.py b/back/backend/policy.py index b143304..2eda9be 100644 --- a/back/backend/policy.py +++ b/back/backend/policy.py @@ -97,7 +97,7 @@ planning_section = Section( "preferred_flight_fare": {"number": 6, "label": "Fare of your preferred flight", "field_type": "decimal"}, "preferred_flight_duration": {"number": 7, "label": "Flight duration of your preferred flight (hours)", "field_type": "decimal"}, "international_flight": {"number": 8, "label": "Is this an international flight?", "field_type": "boolean"}, - "economy_class": {"number": 9, "label": "Is your ticket in economy/coach?", "field_type": "boolea n"}, + "economy_class": {"number": 9, "label": "Is your ticket in economy/coach?", "field_type": "boolean"}, } ) @@ -145,7 +145,7 @@ def departure_date_limit_rule(report, fields): planning_section.add_rule(title="Departure date limit", rule=departure_date_limit_rule) def economy_class_rule(report, fields): - if not economy_class: + if not fields.economy_class: return "Only economy or coach class tickets are within policy." planning_section.add_rule(title="Economy class check", rule=economy_class_rule) From cbac519687a7bb66d1cdc47420152e2b55102812 Mon Sep 17 00:00:00 2001 From: joe-arriaga Date: Wed, 6 Mar 2019 14:49:50 -0800 Subject: [PATCH 3/4] Update policy.py --- back/backend/policy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/backend/policy.py b/back/backend/policy.py index 2eda9be..7f2e93a 100644 --- a/back/backend/policy.py +++ b/back/backend/policy.py @@ -145,7 +145,7 @@ def departure_date_limit_rule(report, fields): planning_section.add_rule(title="Departure date limit", rule=departure_date_limit_rule) def economy_class_rule(report, fields): - if not fields.economy_class: + if not fields[economy_class]: return "Only economy or coach class tickets are within policy." planning_section.add_rule(title="Economy class check", rule=economy_class_rule) From fdc3ebad96fbd7ab3f12439503009c368494831c Mon Sep 17 00:00:00 2001 From: joe-arriaga Date: Wed, 6 Mar 2019 16:42:58 -0800 Subject: [PATCH 4/4] Update policy.py --- back/backend/policy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/backend/policy.py b/back/backend/policy.py index 7f2e93a..d402713 100644 --- a/back/backend/policy.py +++ b/back/backend/policy.py @@ -145,7 +145,7 @@ def departure_date_limit_rule(report, fields): planning_section.add_rule(title="Departure date limit", rule=departure_date_limit_rule) def economy_class_rule(report, fields): - if not fields[economy_class]: + if not fields['economy_class']: return "Only economy or coach class tickets are within policy." planning_section.add_rule(title="Economy class check", rule=economy_class_rule)