Skip to content

Commit 0466d21

Browse files
Editting compartment 2 utils to be easier to understand and obtain nhs_numbers in a nicer way.
Added an if statement to compartment 1 as the confirm button is not always present
1 parent af5b01a commit 0466d21

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

tests/Smokescreen/test_compartment_1.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
@pytest.mark.smoke
88
@pytest.mark.smokescreen
9+
@pytest.mark.compartment1
910
def test_compartment_1(page: Page) -> None:
1011

1112
page.goto("/")
@@ -19,7 +20,8 @@ def test_compartment_1(page: Page) -> None:
1920
CreateAPlan(page).click_set_all_button()
2021
CreateAPlan(page).fill_daily_invitation_rate_field("10")
2122
CreateAPlan(page).click_update_button()
22-
CreateAPlan(page).click_confirm_button()
23+
if CreateAPlan(page).confirm_button.is_visible():
24+
CreateAPlan(page).click_confirm_button()
2325
CreateAPlan(page).click_save_button()
2426
CreateAPlan(page).fill_note_field("test data")
2527
CreateAPlan(page).click_saveNote_button()

tests/Smokescreen/test_compartment_2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_compartment_2(page: Page) -> None:
2323
LogDevices(page).fill_sample_date_field(sample_date)
2424
LogDevices(page).verify_successfully_logged_device_text()
2525

26-
nhs_no = subjectdf["subject_nhs_number"].iloc[0]
26+
nhs_no = subjectdf["nhs_number"].iloc[0]
2727
verify_subject_event_status_by_nhs_no(page, nhs_no, "S43 - Kit Returned and Logged (Initial Test)")
2828

2929
NavigationBar(page).click_main_menu_link()

utils/fit_kit_generation.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,10 @@ def create_fit_id_df():
77
df["fit_device_id"] = df["kitid"].apply(calculate_check_digit)
88
df["fit_device_id"] = df["fit_device_id"].apply(convert_kit_id_to_fit_device_id)
99

10-
temp_string = df["screening_subject_id"].apply(str).iloc[0]
11-
for subject in range(df.shape[0]):
12-
subject_id = df["screening_subject_id"].apply(str).iloc[subject]
13-
temp_string += f" or SCREENING_SUBJECT_ID = {subject_id}"
14-
15-
df = get_nhs_number_from_subject_id(temp_string, df)
1610
return df
1711

1812
def get_kit_id_from_db():
19-
kit_id_df = OracleDB().execute_query("""select tk.kitid, tk.screening_subject_id
13+
kit_id_df = OracleDB().execute_query("""select tk.kitid, tk.screening_subject_id, sdc.nhs_number
2014
from tk_items_t tk
2115
inner join ep_subject_episode_t se on se.screening_subject_id = tk.screening_subject_id
2216
inner join screening_subject_t sst on (sst.screening_subject_id = tk.screening_subject_id)
@@ -43,8 +37,3 @@ def convert_kit_id_to_fit_device_id(kit_id: str):
4337
today = datetime.now()
4438
year = today.strftime("%y") # Get the year from todays date in YY format
4539
return f"{kit_id}12{int(year)+1}12345/KD00001"
46-
47-
def get_nhs_number_from_subject_id(subject_ids, df):
48-
temp_df = OracleDB().execute_query(f"SELECT SCREENING_SUBJECT_ID, SUBJECT_NHS_NUMBER FROM SCREENING_SUBJECT_T WHERE SCREENING_SUBJECT_ID = {subject_ids}")
49-
df = df.merge(temp_df[["screening_subject_id","subject_nhs_number"]], on="screening_subject_id", how="left")
50-
return df

0 commit comments

Comments
 (0)