Skip to content

Commit

Permalink
Merge branch 'dev' into feat/monitoring-check-list
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesvedder authored Jun 17, 2024
2 parents 4a1f59a + 02111ac commit 7a8c778
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions designer_v2/lib/repositories/api_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class StudyUApiClient extends SupabaseClientDependant
'study_ended_count',
'active_subject_count',
'contact',
'created_at',
];

static final studyWithParticipantActivityColumns = [
Expand Down
11 changes: 11 additions & 0 deletions designer_v2/lib/repositories/study_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ class StudyRepository extends ModelRepository<Study>
return publishOperation.execute();
}

/// This method fetches the full study object, duplicates it and saves it as a draft.
/// Since the Study object in the dashboard is fetched with limited columns (no intervention or measurement data),
/// we need to fetch the full columns in order to duplicate it correctly.
@override
Future<void> duplicateAndSave(Study model) async {
final Study completeModel = await apiClient.fetchStudy(model.id);
final duplicate =
completeModel.duplicateAsDraft(authRepository.currentUser!.id);
await save(duplicate);
}

@override
List<ModelAction> availableActions(Study model) {
Future<void> onDeleteCallback() {
Expand Down

0 comments on commit 7a8c778

Please sign in to comment.