Skip to content

Commit

Permalink
Fix new study flash msg
Browse files Browse the repository at this point in the history
  • Loading branch information
kaitj committed Feb 25, 2024
1 parent 293d907 commit 988a422
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions autobidsportal/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def new_study() -> str | Response:
db.session.commit() # pyright: ignore

flash(
"Thanks, the survey has been submitted!<br/>"
"Thanks, the survey has been submitted! "
"If you haven't already, please add 'bidsdump' as an authorized user to "
"your study on the CFMM DICOM server.",
)
Expand Down Expand Up @@ -396,8 +396,7 @@ def admin(user_id: int) -> str:
# Get all available studies
all_studies = db.session.query(Study).all() # pyright: ignore
form.choices.choices = [
(study.id, f"{study.principal}^{study.project_name}")
for study in all_studies
(study.id, f"{study.principal}^{study.project_name}") for study in all_studies
]
removal_form.choices_to_remove.choices = form.choices.choices

Expand Down Expand Up @@ -427,9 +426,7 @@ def admin(user_id: int) -> str:
db.session.commit() # pyright: ignore
# If valid form, remove user authorization from selected studies
if removal_form.validate_on_submit():
for (
study_id
) in removal_form.choices_to_remove.data: # pyright: ignore
for study_id in removal_form.choices_to_remove.data: # pyright: ignore
study = Study.query.get(study_id)
if user in study.users_authorized:
study.users_authorized.remove(user)
Expand Down Expand Up @@ -539,9 +536,7 @@ def answer_info(study_id: int):

# Render form for running tar2bids and handle processing
form = Tar2bidsRunForm()
form.tar_files.choices = [
(tar_file.id, "Yes") for tar_file in cfmm2tar_files
]
form.tar_files.choices = [(tar_file.id, "Yes") for tar_file in cfmm2tar_files]
form.tar_files.default = []
form.process() # pyright: ignore

Expand Down Expand Up @@ -633,10 +628,7 @@ def study_config(study_id: int) -> str:
/ current_app.config["HEURISTIC_DIR_PATH"]
).iterdir()
]
+ [
(heuristic, f"{heuristic} (container)")
for heuristic in DEFAULT_HEURISTICS
],
+ [(heuristic, f"{heuristic} (container)") for heuristic in DEFAULT_HEURISTICS],
key=lambda option: option[1].lower(),
)

Expand Down Expand Up @@ -748,9 +740,7 @@ def delete_cfmm2tar(study_id: int, cfmm2tar_id: int):
return answer_info(study_id)

cfmm2tar_output = Cfmm2tarOutput.query.get(cfmm2tar_id)
if (cfmm2tar_output is not None) and (
cfmm2tar_output.study_id == study_id
):
if (cfmm2tar_output is not None) and (cfmm2tar_output.study_id == study_id):
delete_tar_file(study_id, cfmm2tar_output.tar_file)
db.session.delete(cfmm2tar_output) # pyright: ignore
db.session.commit() # pyright: ignore
Expand Down Expand Up @@ -949,9 +939,7 @@ def run_tar2bids(study_id: int) -> str:
Cfmm2tarOutput.query.get_or_404(tar_file_id)
for tar_file_id in form.tar_files.data # pyright: ignore
]
tar_files = [
tar_file for tar_file in tar_files if tar_file.study_id == study_id
]
tar_files = [tar_file for tar_file in tar_files if tar_file.study_id == study_id]

if (
len(
Expand Down Expand Up @@ -1383,8 +1371,7 @@ def list_globus_users() -> Response:
"type": dataset.dataset_type.to_bids_str(),
"path": f"{path_base}/{dataset.ria_alias}",
"users": [
username.username
for username in dataset.study.globus_usernames
username.username for username in dataset.study.globus_usernames
],
}
for dataset in DataladDataset.query.filter(
Expand Down

0 comments on commit 988a422

Please sign in to comment.