Skip to content

Commit 0c2f1dc

Browse files
committed
Added data to Case dataclass for status, cpr, name, case_worker
1 parent 6d4ac03 commit 0c2f1dc

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

changelog.md

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

88
## [Unreleased]
99

10+
### Added
11+
12+
- Added fields to Case dataclass for status, cpr, name, case_worker
13+
1014
### Changed
1115

1216
- eflyt.eflyt_case.change_tab now checks if the tab needs to be changed before doing it.

itk_dev_shared_components/eflyt/eflyt_case.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ class Case:
1212
case_number: str
1313
deadline: date | None
1414
case_types: list[str]
15+
status: str | None
16+
cpr: str | None
17+
name: str | None
18+
case_worker: str | None
1519

1620

1721
@dataclass

itk_dev_shared_components/eflyt/eflyt_search.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,14 @@ def extract_cases(browser: webdriver.Chrome) -> list[Case]:
7676
# If the case types ends with '...' we need to get the title instead
7777
if case_types_text.endswith("..."):
7878
case_types_text = row.find_element(By.XPATH, "td[5]").get_attribute("Title")
79-
8079
case_types = case_types_text.split(", ")
81-
case = Case(case_number, deadline, case_types)
80+
81+
status = row.find_element(By.XPATH, "td[6]").text
82+
cpr = row.find_element(By.XPATH, "td[7]/a").text
83+
name = row.find_element(By.XPATH, "td[8]").text
84+
case_worker = row.find_element(By.XPATH, "td[9]").text
85+
86+
case = Case(case_number, deadline, case_types, status, cpr, name, case_worker)
8287
cases.append(case)
8388

8489
return cases

tests/test_eflyt/test_search.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ def test_extract_cases(self):
3333
self.assertIsInstance(case.case_number, str)
3434
self.assertIsInstance(case.case_types, list)
3535
self.assertIsInstance(case.deadline, (date, type(None)))
36+
self.assertIsInstance(case.status, (str, type(None)))
37+
self.assertIsInstance(case.cpr, (str, type(None)))
38+
self.assertIsInstance(case.name, (str, type(None)))
39+
self.assertIsInstance(case.case_worker, (str, type(None)))
3640

3741
def test_open_case(self):
3842
"""Open a case and check the browser opened the case view"""

0 commit comments

Comments
 (0)