Skip to content

Commit

Permalink
refactor: study type get
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrahimozkn committed Sep 6, 2024
1 parent 0817f29 commit 97bad1e
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions core/lib/src/models/tables/study.dart
Original file line number Diff line number Diff line change
Expand Up @@ -276,15 +276,7 @@ class Study extends SupabaseObjectFunctions<Study>
}

StudyType get type {
if (templateConfiguration != null && parentTemplateId == null) {
return StudyType.template;
}

if (parentTemplateId != null) {
return StudyType.subStudy;
}

return StudyType.standalone;
return studyType ?? StudyType.standalone;
}

bool get isStandalone => type == StudyType.standalone;
Expand Down Expand Up @@ -376,6 +368,7 @@ class Template extends Study {
factory Template.fromStudy(Study study) {
return Template(study.id, study.userId)
..title = study.title
..studyType = study.studyType
..description = study.description
..participation = study.participation
..resultSharing = study.resultSharing
Expand Down

0 comments on commit 97bad1e

Please sign in to comment.