diff --git a/core/lib/src/models/tables/study.dart b/core/lib/src/models/tables/study.dart index 0f6d773bd..ba0508cdd 100644 --- a/core/lib/src/models/tables/study.dart +++ b/core/lib/src/models/tables/study.dart @@ -74,7 +74,7 @@ class Study extends SupabaseObjectFunctions { Questionnaire? fhirQuestionnaire; @JsonKey(includeToJson: false, includeFromJson: false) - late List studyTags = []; + List studyTags = []; @JsonKey(includeToJson: false, includeFromJson: false) int participantCount = 0; @@ -108,16 +108,12 @@ class Study extends SupabaseObjectFunctions { final study = _$StudyFromJson(json); final List? studyTags = json['study_tags'] as List?; if (studyTags != null) { - study.studyTags = studyTags - .map( + study.studyTags = studyTags.map( (json) => StudyTag.fromTag( studyId: study.id, tag: Tag.fromJson(json as Map), ), - ) - .toList(); - } else { - study.studyTags = []; + ).toList(); } final List? repo = json['repo'] as List?; @@ -265,6 +261,6 @@ class Study extends SupabaseObjectFunctions { @override String toString() { - return 'Study{id: $id, title: $title, description: $description, tag: $studyTags, userId: $userId, participation: $participation, resultSharing: $resultSharing, contact: $contact, iconName: $iconName, published: $published, questionnaire: $questionnaire, eligibilityCriteria: $eligibilityCriteria, consent: $consent, interventions: $interventions, observations: $observations, schedule: $schedule, reportSpecification: $reportSpecification, results: $results, collaboratorEmails: $collaboratorEmails, registryPublished: $registryPublished, fhirQuestionnaire: $fhirQuestionnaire, participantCount: $participantCount, endedCount: $endedCount, activeSubjectCount: $activeSubjectCount, missedDays: $missedDays, repo: $repo, invites: $invites, participants: $participants, participantsProgress: $participantsProgress, createdAt: $createdAt}'; + return 'Study{id: $id, title: $title, description: $description, studyTags: $studyTags, userId: $userId, participation: $participation, resultSharing: $resultSharing, contact: $contact, iconName: $iconName, published: $published, questionnaire: $questionnaire, eligibilityCriteria: $eligibilityCriteria, consent: $consent, interventions: $interventions, observations: $observations, schedule: $schedule, reportSpecification: $reportSpecification, results: $results, collaboratorEmails: $collaboratorEmails, registryPublished: $registryPublished, fhirQuestionnaire: $fhirQuestionnaire, participantCount: $participantCount, endedCount: $endedCount, activeSubjectCount: $activeSubjectCount, missedDays: $missedDays, repo: $repo, invites: $invites, participants: $participants, participantsProgress: $participantsProgress, createdAt: $createdAt}'; } } diff --git a/designer_v2/lib/domain/study.dart b/designer_v2/lib/domain/study.dart index 6088126f7..a0bcd708c 100644 --- a/designer_v2/lib/domain/study.dart +++ b/designer_v2/lib/domain/study.dart @@ -131,8 +131,8 @@ extension StudyDuplicateX on Study { return copy; } -// todo tags Study copyJsonIgnoredAttributes({required Study from, createdAt = false}) { + studyTags = from.studyTags; participantCount = from.participantCount; activeSubjectCount = from.activeSubjectCount; endedCount = from.endedCount; @@ -147,8 +147,8 @@ extension StudyDuplicateX on Study { return this; } -// todo tags Study resetJsonIgnoredAttributes() { + studyTags = []; participantCount = 0; activeSubjectCount = 0; endedCount = 0; diff --git a/designer_v2/lib/features/design/info/study_info_form_view.dart b/designer_v2/lib/features/design/info/study_info_form_view.dart index d33369557..996c51e18 100644 --- a/designer_v2/lib/features/design/info/study_info_form_view.dart +++ b/designer_v2/lib/features/design/info/study_info_form_view.dart @@ -88,7 +88,7 @@ class StudyDesignInfoFormView extends StudyDesignPageWidget { labelHelpText: 'tr.form_field_study_tags_tooltip', input: ReactiveFormConsumer(builder: (context, form, child) { final tags = ref.read(tagRepositoryProvider); - final studyTags = ref.watch(studyTagRepositoryProvider(studyId)); + final studyTags = ref.read(studyTagRepositoryProvider(studyId)); final selectedTags = formViewModel.tagsControl.value! .map((e) => MultiSelectItem(value: e.tag, name: e.name)) .toList(); diff --git a/designer_v2/lib/repositories/api_client.dart b/designer_v2/lib/repositories/api_client.dart index 0aaaaeb9c..23f6b4a3f 100644 --- a/designer_v2/lib/repositories/api_client.dart +++ b/designer_v2/lib/repositories/api_client.dart @@ -142,8 +142,8 @@ class StudyUApiClient extends SupabaseClientDependant with SupabaseQueryMixin im @override Future saveStudy(Study study) async { await _testDelay(); - // Chain a fetch request to make sure we return a complete & updated study - final request = study.save(); //.then((study) => fetchStudy(study.id)); + // Chain a fetch request to make sure we return a complete and updated study + final request = study.save().then((study) => fetchStudy(study.id)); return _awaitGuarded(request); }