Skip to content

Commit

Permalink
Merge pull request #910 from aanil/samples_tab
Browse files Browse the repository at this point in the history
Sort projects by project number so that the latest P-number is first
  • Loading branch information
aanil authored Jan 10, 2025
2 parents 0a755a9 + 6e38938 commit b029e9d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion status/flowcells.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def list_flowcells(self, all=False):
note_key = row.key
# NovaSeqXPlus has whole year in name
if "LH" in row.value["instrument"]:
note_key = f'{row.value["run id"].split("_")[0]}_{row.value["run id"].split("_")[-1]}'
note_key = f"{row.value['run id'].split('_')[0]}_{row.value['run id'].split('_')[-1]}"
note_keys.append(note_key)
temp_flowcells[row.key] = row.value

Expand Down
10 changes: 5 additions & 5 deletions status/invoicing.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def get_proj_doc(self, proj_id: str) -> dict:

def get_order_details(self, order_id: str) -> dict:
order_url = (
f'{self.application.order_portal_conf["api_get_order_url"]}/{order_id}'
f"{self.application.order_portal_conf['api_get_order_url']}/{order_id}"
)
headers = {
"X-OrderPortal-API-key": self.application.order_portal_conf["api_token"]
Expand Down Expand Up @@ -216,9 +216,9 @@ def post(self):
row = [
proj_specs["total_cost"],
" ",
f'{proj_specs["id"]}, {proj_specs["name"]}',
f"{proj_specs['id']}, {proj_specs['name']}",
"1,00",
f'({proj_specs["cust_desc"]})',
f"({proj_specs['cust_desc']})",
account_dets["fakturaunderlag"],
account_dets["fakturafragor"],
account_dets["support_email"],
Expand All @@ -229,7 +229,7 @@ def post(self):
account_dets["unit"],
account_dets["number"],
" ",
f'{proj_specs["id"]}, {proj_specs["name"]}',
f"{proj_specs['id']}, {proj_specs['name']}",
contact_dets["reference"],
account_dets["ansvarig"],
proj_specs["close_date"],
Expand Down Expand Up @@ -324,7 +324,7 @@ def get_invoice_data(
agreement_doc["invoice_spec_generated_at"] / 1000.0
).strftime("%Y-%m-%d")
proj_specs["contract_name"] = (
f'{proj_id}_{agreement_doc["invoice_spec_generated_for"]}'
f"{proj_id}_{agreement_doc['invoice_spec_generated_for']}"
)
proj_specs["summary"] = markdown.markdown(
invoiced_agreement["agreement_summary"], extensions=["sane_lists"]
Expand Down
7 changes: 7 additions & 0 deletions status/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,13 @@ def search_project_names(self, search_string=""):
}
projects.append(project)

# Sort projects by project number so that the latest P-number is first
projects = sorted(
projects,
key=lambda x: int(x["name"].split(",")[0].replace("P", "")),
reverse=True,
)

return projects


Expand Down
4 changes: 3 additions & 1 deletion status/running_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,11 @@ def notify_tagged_user(
)
msg["From"] = "genomics-status"
msg["To"] = view_result[user]
text = f"{email_text} in the project {project_id}, {project_name}! The note is as follows\n\
text = (
f"{email_text} in the project {project_id}, {project_name}! The note is as follows\n\
>{tagger} - {time_in_format}{category}\
>{note}"
)

html = '<html>\
<body>\
Expand Down
2 changes: 1 addition & 1 deletion status/sample_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def _validate_unique(self, items):
self._add_validation_msg(
id,
"unique",
(f"Key combination {keys}:{t} is included multiple " "times. "),
(f"Key combination {keys}:{t} is included multiple times. "),
)
self.validation_result = False
key_val_set.add(t)
Expand Down

0 comments on commit b029e9d

Please sign in to comment.