Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.1.0] - 2025-03-17

### Added

- Skip cases of type "Boligselskab" where there are inhabitants on the address

### Fixed

- Added wait time to from_date element

## [1.0.1] - 2025-02-07

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "robot_framework"
version = "1.0.1"
version = "1.1.0"
authors = [
{ name="ITK Development", email="itk-rpa@mkb.aarhus.dk" },
]
Expand Down
15 changes: 12 additions & 3 deletions robot_framework/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from OpenOrchestrator.orchestrator_connection.connection import OrchestratorConnection, QueueStatus
from itk_dev_shared_components.eflyt import eflyt_login, eflyt_search, eflyt_case
from itk_dev_shared_components.eflyt.eflyt_case import Case
Expand All @@ -24,7 +26,7 @@ def process(orchestrator_connection: OrchestratorConnection) -> None:
for case in cases:
queue_element = orchestrator_connection.create_queue_element(config.QUEUE_NAME, reference=case.case_number)
eflyt_search.open_case(browser, case.case_number)
if handle_case(browser):
if handle_case(browser, case):
orchestrator_connection.log_info(f"Case {case.case_number} approved.")
orchestrator_connection.set_queue_element_status(queue_element.id, QueueStatus.DONE)

Expand Down Expand Up @@ -55,7 +57,7 @@ def filter_cases(cases: list[Case]) -> list[Case]:
return filtered_cases


def handle_case(browser: webdriver.Chrome) -> bool:
def handle_case(browser: webdriver.Chrome, case: Case) -> bool:
"""Check dates on each case, approve all cases where dates match.

Args:
Expand All @@ -64,13 +66,20 @@ def handle_case(browser: webdriver.Chrome) -> bool:
Returns:
Whether the case was approved or not
"""
if "Boligselskab" in case.case_types and len(eflyt_case.get_beboere(browser)) != 0:
return False

eflyt_case.change_tab(browser, 0)
registered_date = browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_GridViewMovingPersons_ctl02_lnkDateCPR").text
vis_svar_element = browser.find_element(By.LINK_TEXT, "Vis svar")
if vis_svar_element:
vis_svar_element.click()
else:
return False
response_date = browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_moPersonTab_txtFradato").get_attribute("value")
from_date_element = WebDriverWait(browser, 10).until(
EC.presence_of_element_located((By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_moPersonTab_txtFradato"))
)
response_date = from_date_element.get_attribute("value")

selection_table = browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_moPersonTab_rdoEDSLogivartResponseType")
request_match = False
Expand Down