Commit c27687f8 by Shirley He

fix dates

parent 21a21832
...@@ -99,10 +99,12 @@ def generate_permutations(field_args, index, results, courses_dict, field_values ...@@ -99,10 +99,12 @@ def generate_permutations(field_args, index, results, courses_dict, field_values
# add permutation fields to dict # add permutation fields to dict
field_values_dict[permutation_option] = permutation_value field_values_dict[permutation_option] = permutation_value
# generate start and end dates date_values = ["future", "past"]
if permutation_option in ["start", "end"]:
permutation_value = calculate_date_value(permutation_value) for dates in date_values:
field_values_dict[permutation_option] = permutation_value if dates in permutations_values:
permutation_value = calculate_date_value(dates)
field_values_dict[permutation_option] = permutation_value
for permutation_key in all_permutations_keys: for permutation_key in all_permutations_keys:
# add audit and verify fields to dict # add audit and verify fields to dict
...@@ -140,8 +142,6 @@ def calculate_date_value(date_const): ...@@ -140,8 +142,6 @@ def calculate_date_value(date_const):
if date_const == PAST_DATE: if date_const == PAST_DATE:
past = str(now - datetime.timedelta(days=60)) past = str(now - datetime.timedelta(days=60))
return past return past
if date_const == None:
return None
except ValueError: except ValueError:
print "Dates can only be future or past" print "Dates can only be future or past"
sys.exit() sys.exit()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment