diff options
| author | Teddy Wing | 2018-02-04 05:03:50 +0100 |
|---|---|---|
| committer | Teddy Wing | 2018-02-04 05:03:50 +0100 |
| commit | f8091aab64e962a7f53168415fd5d01f1e7cb24e (patch) | |
| tree | 98decde4872fa359d01d4825fd9ee3cc877241c2 /harvester_submit_week_for_approval.py | |
| parent | bc96ac39c0aec5d40578d85f5f9714d366821c91 (diff) | |
| download | harvester-submit-week-for-approval-f8091aab64e962a7f53168415fd5d01f1e7cb24e.tar.bz2 | |
submit_week_for_approval: Don't submit if already submitted
Check that the timesheet hasn't already been submitted before trying to
submit it. Otherwise we'd resubmit the timesheet which is not what we
want. We only want a single submission across successive runs of the
program.
Diffstat (limited to 'harvester_submit_week_for_approval.py')
| -rw-r--r-- | harvester_submit_week_for_approval.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/harvester_submit_week_for_approval.py b/harvester_submit_week_for_approval.py index 1731f73..6f9e047 100644 --- a/harvester_submit_week_for_approval.py +++ b/harvester_submit_week_for_approval.py @@ -56,10 +56,15 @@ def submit_week_for_approval(driver, wait, subdomain): '//a[@aria-label="{}"]'.format(friday.strftime('%A, %d %B')) ))) + approval_button = driver.find_element_by_css_selector( + '.approval-button .submit-link') + + # Don't submit if the time sheet has already been submitted + if approval_button.text == 'Resubmit Week for Approval': + return driver + # Click "Submit Week for Approval" button - driver.find_element_by_css_selector( - '.approval-button .submit-link' - ).click() + approval_button.click() # Click "Yes, Submit Timesheet" button wait.until( |
