Skip to content

Commit fdea155

Browse files
committed
Fixed approve case
1 parent a4d244f commit fdea155

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [2.8.1] - 2024-12-02
11+
12+
### Fixed
13+
14+
- Approve case in eflyt when approvig individual people now works.
15+
1016
## [2.8.0] - 2024-10-02
1117

1218
### Added

itk_dev_shared_components/eflyt/eflyt_case.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ def change_tab(browser: webdriver.Chrome, tab_index: int):
130130

131131

132132
def approve_case(browser: webdriver.Chrome):
133-
"""Approve a case, even if blocked by a note."""
133+
"""Approve a case.
134+
If any person on the case is blocking approval, approve each person individually.
135+
"""
134136
change_tab(browser, 0)
135137

136138
deadline_field = browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_ncPersonTab_txtDeadline")
@@ -142,20 +144,22 @@ def approve_case(browser: webdriver.Chrome):
142144
browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_stcPersonTab1_btnApproveYes").click()
143145

144146
approve_persons_button = browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_stcPersonTab1_btnGodkendAlle")
145-
if not approve_persons_button.is_enabled():
147+
if approve_persons_button.is_enabled():
148+
approve_persons_button.click()
149+
else:
150+
# Approve each person individually
151+
person_count = len(browser.find_elements(By.XPATH, '//table[@id="ctl00_ContentPlaceHolder2_GridViewMovingPersons"]//tr'))
146152

147-
person_table = browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_GridViewMovingPersons")
148-
rows = person_table.find_elements(By.TAG_NAME, "tr")
149-
rows.pop(0)
153+
for i in range(person_count):
154+
browser.find_element(By.XPATH, f'//table[@id="ctl00_ContentPlaceHolder2_GridViewMovingPersons"]//tr[{i+2}]//td[2]').click()
150155

151-
for row in rows:
152-
row.find_element(By.XPATH, "td[2]").click()
153156
browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_stcPersonTab1_btnGodkend").click()
154157
approve_button = browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_stcPersonTab1_btnApproveYes")
155158
if approve_button.is_displayed():
156159
approve_button.click()
157-
else:
158-
approve_persons_button.click()
160+
161+
# Go back to the case
162+
browser.find_element(By.XPATH, '//table[@id="ctl00_ContentPlaceHolder2_GridViewMovingPersons"]//tr[1]//td[2]').click()
159163

160164

161165
def check_all_approved(browser: webdriver.Chrome) -> bool:

0 commit comments

Comments
 (0)