Skip to content

Commit

Permalink
Dedupe frequency list: use DATE_LABEL keys
Browse files Browse the repository at this point in the history
refs #18
  • Loading branch information
deoren committed Jun 3, 2018
1 parent 5fd5fb6 commit 93beab4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
22 changes: 3 additions & 19 deletions automated_tickets.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,13 @@
)

# This will need to be broken up later by the script
# WARNING: This needs to be kept in sync with DATE_LABEL within
# the library file.
parser.add_argument(
'--event_schedule',
action='store',
required=True,
choices=[
'daily',
'twice_week',
'weekly_monday',
'weekly_tuesday',
'weekly_wednesday',
'weekly_thursday',
'weekly_friday',
'weekly_saturday',
'weekly_sunday',
'weekly',
'twice_month',
'monthly',
'twice_year',
'quarterly',
'yearly'
]

# Reuse keys from DATE_LABEL dict in library file instead of repeating here
choices=list(DATE_LABEL.keys())
)

# NOTE: Probably want to leave this as not required and fall back to checking
Expand Down
8 changes: 4 additions & 4 deletions automated_tickets_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@
# we will get the same result as what we're doing here
TODAY = date.strftime('%Y-%m-%d')

# These entries match up with the event schedule "keywords". For example,
# when daily events are requested, active daily events will result in
# notifications generated which have subject lines that include the value
# that is paired with the keyword below.
# These entries serve both as a mapping of display formats and also as
# valid parameter values. For example, when daily events are requested,
# active daily events will result in notifications generated which have
# subject lines that include the value that is paired with the keyword below.
DATE_LABEL = {
'daily':TODAY,
'twice_week':TODAY,
Expand Down

0 comments on commit 93beab4

Please sign in to comment.