Skip to content

Commit

Permalink
fixed bugs that appeared after CSH extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Gebhardt authored and Tom Gebhardt committed Nov 21, 2023
1 parent 4b40d28 commit 7da6d69
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
6 changes: 4 additions & 2 deletions app/metrics/assessments_lifespan.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ async def get_tasks_definitions(app: FastAPI):
"""
regex = re.compile(r"^CA-RDA-([FAIR][1-9](\.[0-9])?)-")
regex_csh = re.compile(r"^CSH-RDA-([FAIR][1-9](\.[0-9])?)-")
regex_joined = re.compile(r"^(CA-RDA|CSH-RDA)-([FAIR][1-9](\.[0-9])?)-")
config = get_settings()

print(config)
def parse_line(line):
sub_group = regex_csh.search(line["TaskName"])
sub_group = regex_joined.search(line["TaskName"])
if sub_group is None:
return
sub_group = sub_group.groups()[0]
sub_group = sub_group.groups()[1]
task_group = sub_group[0]
return {
line["TaskName"]: models.Indicator(
Expand Down
11 changes: 10 additions & 1 deletion app/models/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,16 @@ def create_tasks(self):
:return: None
"""
for indicator in fair_indicators.values():
# filter fair_indicators for specific session subject
print("checking here")
if self.user_input.subject_type is SubjectType.csh:
name_filter = 'CSH'
else:
name_filter = 'CA'
filter_indicators = {key: value for key, value in fair_indicators.items() if value.name.startswith(name_filter)}


for indicator in filter_indicators.values():
# Skip if task for indicator is already created
if indicator.name in self.indicator_tasks:
continue
Expand Down
2 changes: 2 additions & 0 deletions app/models/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ def has_valid_name(cls, name: str) -> str:
:param name: The name given by the user
:return: The valid assessment name
"""
#filter indicators according to subject

if name not in fair_indicators:
raise ValueError(f"Given assessment name {name} is not a known indicator")
return name
Expand Down

0 comments on commit 7da6d69

Please sign in to comment.