From b50c26383ae808e9c5560665d0842d1ad9b2e15a Mon Sep 17 00:00:00 2001 From: Johannes Vedder Date: Sun, 14 Jul 2024 09:02:20 +0200 Subject: [PATCH 1/5] feat: make table wrappable --- .../lib/common_views/standard_table.dart | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/designer_v2/lib/common_views/standard_table.dart b/designer_v2/lib/common_views/standard_table.dart index eb32c3f9a..e5b8915a7 100644 --- a/designer_v2/lib/common_views/standard_table.dart +++ b/designer_v2/lib/common_views/standard_table.dart @@ -59,6 +59,7 @@ class StandardTable extends StatefulWidget { this.rowSpacing = 9.0, this.minRowHeight = 60.0, this.headerMaxLines = 1, + this.softWrapHeader = false, this.showTableHeader = true, this.tableWrapper, this.leadingWidget, @@ -108,6 +109,7 @@ class StandardTable extends StatefulWidget { final double? minRowHeight; final int headerMaxLines; + final bool softWrapHeader; final bool showTableHeader; final bool hideLeadingTrailingWhenEmpty; @@ -355,13 +357,15 @@ class _StandardTableState extends State> { ), child: Row( children: [ - Text( - columns[i].label, - overflow: TextOverflow.visible, - maxLines: widget.headerMaxLines, - softWrap: false, - style: theme.textTheme.bodySmall!.copyWith( - color: theme.colorScheme.onSurface.withOpacity(0.8), + Flexible( + child: Text( + columns[i].label, + overflow: TextOverflow.visible, + maxLines: widget.headerMaxLines, + softWrap: widget.softWrapHeader, + style: theme.textTheme.bodySmall!.copyWith( + color: theme.colorScheme.onSurface.withOpacity(0.8), + ), ), ), if (widget.inputColumns[i].sortable) From 47a9de1cef8f294b352c6df64b8f46a0bd9d7c96 Mon Sep 17 00:00:00 2001 From: Johannes Vedder Date: Sun, 14 Jul 2024 09:02:58 +0200 Subject: [PATCH 2/5] chore: cleanup --- designer_v2/lib/domain/study_monitoring.dart | 1 - .../monitor/participant/participant_squares.dart | 16 +++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/designer_v2/lib/domain/study_monitoring.dart b/designer_v2/lib/domain/study_monitoring.dart index ab783794e..e80d27c7c 100644 --- a/designer_v2/lib/domain/study_monitoring.dart +++ b/designer_v2/lib/domain/study_monitoring.dart @@ -107,7 +107,6 @@ extension StudyMonitoringX on Study { ) .map((p) => p.taskId) .toSet(); - print(progresses.toString()); final missedTaskIds = requiredTaskIds.difference(completedTaskIds); missedTasksPerDay.add(missedTaskIds); diff --git a/designer_v2/lib/features/monitor/participant/participant_squares.dart b/designer_v2/lib/features/monitor/participant/participant_squares.dart index 19f744e8f..7e6fb94eb 100644 --- a/designer_v2/lib/features/monitor/participant/participant_squares.dart +++ b/designer_v2/lib/features/monitor/participant/participant_squares.dart @@ -20,7 +20,6 @@ class ParticipantSquares extends StatelessWidget { final theme = Theme.of(context); final phases = _buildPhases(); - print(phases); return Column( crossAxisAlignment: CrossAxisAlignment.start, children: phases.mapIndexed((phaseIndex, phase) { @@ -122,7 +121,6 @@ class ParticipantSquares extends StatelessWidget { monitorItem.completedTasksPerDay.sublist(start, end)), ); } - assert( monitorItem.missedTasksPerDay.length == monitorItem.completedTasksPerDay.length, @@ -136,13 +134,9 @@ class StudyPhase { final List> missedTasksPerDay; final List> completedTasksPerDay; - StudyPhase( - {required this.intervention, - required this.missedTasksPerDay, - required this.completedTasksPerDay}); - - @override - String toString() { - return 'StudyPhase{intervention: $intervention, missedTasksPerDay: $missedTasksPerDay}'; - } + StudyPhase({ + required this.intervention, + required this.missedTasksPerDay, + required this.completedTasksPerDay, + }); } From 3306a4c4ad31c5303802a679304305a6192c9c16 Mon Sep 17 00:00:00 2001 From: Johannes Vedder Date: Sun, 14 Jul 2024 09:03:48 +0200 Subject: [PATCH 3/5] fix: wrap monitor table --- designer_v2/lib/features/monitor/study_monitor_table.dart | 1 + designer_v2/lib/localization/app_de.arb | 4 ++-- designer_v2/lib/localization/app_en.arb | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/designer_v2/lib/features/monitor/study_monitor_table.dart b/designer_v2/lib/features/monitor/study_monitor_table.dart index 6b07e6ad9..70fce141f 100644 --- a/designer_v2/lib/features/monitor/study_monitor_table.dart +++ b/designer_v2/lib/features/monitor/study_monitor_table.dart @@ -85,6 +85,7 @@ class StudyMonitorTable extends ConsumerWidget { rowSpacing: 5.0, minRowHeight: 30.0, headerMaxLines: 2, + softWrapHeader: true, onSelectItem: onSelectItem, ); } diff --git a/designer_v2/lib/localization/app_de.arb b/designer_v2/lib/localization/app_de.arb index 5353aa488..6edc8f738 100644 --- a/designer_v2/lib/localization/app_de.arb +++ b/designer_v2/lib/localization/app_de.arb @@ -572,8 +572,8 @@ "monitoring_table_column_enrolled": "Studienstart", "monitoring_table_column_last_activity": "Letzte Aktivität", "monitoring_table_column_day_in_study": "Studientag", - "monitoring_table_column_completed_interventions": "Abgeschlossene\nInterventionen", - "monitoring_table_column_completed_surveys": "Abgeschlossene\nFragebögen", + "monitoring_table_column_completed_interventions": "Abgeschlossene Interventionen", + "monitoring_table_column_completed_surveys": "Abgeschlossene Fragebögen", "monitoring_table_row_tooltip_dropout": "Dieser Teilnehmer hat die Studie verlassen und es wird keine neue Aktivität hinzugefügt", "monitoring_table_days_in_study_header_tooltip":"Die Anzahl der Tage, die der Teilnehmer in der Studie verbracht hat", "monitoring_table_completed_interventions_header_tooltip": "Eine Intervention zählt als abgeschlossen, wenn alle Aufgaben für den Tag erledigt wurden", diff --git a/designer_v2/lib/localization/app_en.arb b/designer_v2/lib/localization/app_en.arb index f95d86771..2537e647e 100644 --- a/designer_v2/lib/localization/app_en.arb +++ b/designer_v2/lib/localization/app_en.arb @@ -572,8 +572,8 @@ "monitoring_table_column_enrolled": "Started at", "monitoring_table_column_last_activity": "Last activity", "monitoring_table_column_day_in_study": "Day in study", - "monitoring_table_column_completed_interventions": "Completed\ninterventions", - "monitoring_table_column_completed_surveys": "Completed\nsurveys", + "monitoring_table_column_completed_interventions": "Completed interventions", + "monitoring_table_column_completed_surveys": "Completed surveys", "monitoring_table_row_tooltip_dropout": "This participant has dropped out of the study and no new activity will be added", "monitoring_table_days_in_study_header_tooltip":"The number of days the participant has been in the study", "monitoring_table_completed_interventions_header_tooltip": "An intervention is completed, if all of its tasks have been completed for that day", From 2f79ee107f835bb1c049c97789fc2c0eb95373a2 Mon Sep 17 00:00:00 2001 From: Johannes Vedder Date: Sun, 14 Jul 2024 09:04:09 +0200 Subject: [PATCH 4/5] fix: analyze test translation --- designer_v2/lib/localization/app_de.arb | 2 +- designer_v2/lib/localization/app_en.arb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_v2/lib/localization/app_de.arb b/designer_v2/lib/localization/app_de.arb index 6edc8f738..dd02207c3 100644 --- a/designer_v2/lib/localization/app_de.arb +++ b/designer_v2/lib/localization/app_de.arb @@ -579,7 +579,7 @@ "monitoring_table_completed_interventions_header_tooltip": "Eine Intervention zählt als abgeschlossen, wenn alle Aufgaben für den Tag erledigt wurden", "monitoring_table_completed_surveys_header_tooltip":"Die Umfrage zählt als abgeschlossen, wenn alle Aufgaben für den Tag erledigt wurden", "@__________________STUDYPAGE_ANALYZE__________________": {}, - "banner_text_study_analyze_draft": "Solange die Studie noch nicht live ist, basieren die Ergebnisse hier auf dem letzten Testlauf der Studie (siehe Testmodus).\nDie Ergebnisdaten werden automatisch zurückgesetzt sobald die Studie mit echten Teilnehmern startet.", + "banner_text_study_analyze_draft": "Solange die Studie noch nicht live ist, basieren die Ergebnisse hier auf den Daten aus den Testläufen der Studie.\nDie Ergebnisdaten werden automatisch zurückgesetzt sobald die Studie mit echten Teilnehmern startet.", "action_button_study_export": "Daten exportieren", "action_button_study_export_prompt": "Möchtest du deine eigene Analyse durchführen?", "study_export_unavailable_empty_tooltip": "Es sind noch keine Ergebnisdaten verfügbar", diff --git a/designer_v2/lib/localization/app_en.arb b/designer_v2/lib/localization/app_en.arb index 2537e647e..f23f56a42 100644 --- a/designer_v2/lib/localization/app_en.arb +++ b/designer_v2/lib/localization/app_en.arb @@ -579,7 +579,7 @@ "monitoring_table_completed_interventions_header_tooltip": "An intervention is completed, if all of its tasks have been completed for that day", "monitoring_table_completed_surveys_header_tooltip":"A survey is completed, if all of its tasks have been completed for that day", "@__________________STUDYPAGE_ANALYZE__________________": {}, - "banner_text_study_analyze_draft": "Because this study has not been launched yet, this page is currently based on the data generated during study testing (only the latest test session).\nThe data on this page will be reset once you launch the study with real participants.", + "banner_text_study_analyze_draft": "Because this study has not been launched yet, this page is currently based on the data generated during study testing.\nThe data on this page will be reset once you launch the study with real participants.", "action_button_study_export": "Export data", "action_button_study_export_prompt": "Want to run your own analysis?", "study_export_unavailable_empty_tooltip": "There is no data available yet", From 59d70f85bab2113d956016546135ad5b46e85500 Mon Sep 17 00:00:00 2001 From: Johannes Vedder Date: Sun, 14 Jul 2024 09:04:26 +0200 Subject: [PATCH 5/5] fix: print additional details in participant info --- .../participant/participant_details_view.dart | 5 +-- .../monitor/participant/participant_info.dart | 34 ++++++++++++------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/designer_v2/lib/features/monitor/participant/participant_details_view.dart b/designer_v2/lib/features/monitor/participant/participant_details_view.dart index dbcf64ce3..60cd48883 100644 --- a/designer_v2/lib/features/monitor/participant/participant_details_view.dart +++ b/designer_v2/lib/features/monitor/participant/participant_details_view.dart @@ -24,10 +24,7 @@ class ParticipantDetailsView extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ ParticipantInfo( - participantId: monitorItem.participantId, - inviteCode: monitorItem.inviteCode, - startedAt: monitorItem.startedAt, - lastActivityAt: monitorItem.lastActivityAt, + monitorItem: monitorItem, ), const SizedBox(height: 8.0), const Divider(), diff --git a/designer_v2/lib/features/monitor/participant/participant_info.dart b/designer_v2/lib/features/monitor/participant/participant_info.dart index 8739525ef..3b67ad17e 100644 --- a/designer_v2/lib/features/monitor/participant/participant_info.dart +++ b/designer_v2/lib/features/monitor/participant/participant_info.dart @@ -1,22 +1,17 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:studyu_designer_v2/domain/study_monitoring.dart'; import 'package:studyu_designer_v2/localization/app_translation.dart'; import 'package:studyu_designer_v2/localization/locale_providers.dart'; import 'package:studyu_designer_v2/utils/extensions.dart'; class ParticipantInfo extends ConsumerWidget { const ParticipantInfo({ - required this.participantId, - required this.inviteCode, - required this.startedAt, - required this.lastActivityAt, + required this.monitorItem, super.key, }); - final String participantId; - final String? inviteCode; - final DateTime startedAt; - final DateTime lastActivityAt; + final StudyMonitorItem monitorItem; @override Widget build(BuildContext context, WidgetRef ref) { @@ -27,19 +22,33 @@ class ParticipantInfo extends ConsumerWidget { children: [ _buildInfoRow( tr.monitoring_table_column_participant_id, - participantId, + monitorItem.participantId, ), _buildInfoRow( tr.monitoring_table_column_invite_code, - inviteCode ?? 'N/A', + monitorItem.inviteCode ?? 'N/A', ), _buildInfoRow( tr.monitoring_table_column_enrolled, - startedAt.toLocalizedString(locale: languageCode, showTime: false), + monitorItem.startedAt + .toLocalizedString(locale: languageCode, showTime: false), ), _buildInfoRow( tr.monitoring_table_column_last_activity, - lastActivityAt.toLocalizedString(locale: languageCode), + monitorItem.lastActivityAt.toLocalizedString(locale: languageCode), + ), + const SizedBox(height: 8.0), + _buildInfoRow( + tr.monitoring_table_column_day_in_study, + '${monitorItem.currentDayOfStudy}/${monitorItem.studyDurationInDays}', + ), + _buildInfoRow( + tr.monitoring_table_column_completed_interventions, + '${monitorItem.completedInterventions}/${monitorItem.completedInterventions + monitorItem.missedInterventions}', + ), + _buildInfoRow( + tr.monitoring_table_column_completed_surveys, + '${monitorItem.completedSurveys}/${monitorItem.completedSurveys + monitorItem.missedSurveys}', ), ], ), @@ -48,6 +57,7 @@ class ParticipantInfo extends ConsumerWidget { Widget _buildInfoRow(String label, String value) { return Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( '$label: ',