Skip to content

Commit

Permalink
Merge branch 'feat/monitoring-check-list-merge' of https://github.com…
Browse files Browse the repository at this point in the history
…/hpi-studyu/studyu into feat/monitoring-check-list-merge
  • Loading branch information
ibrahimozkn committed Jul 14, 2024
2 parents 31fe183 + 59d70f8 commit bcb8000
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 41 deletions.
18 changes: 11 additions & 7 deletions designer_v2/lib/common_views/standard_table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class StandardTable<T> extends StatefulWidget {
this.rowSpacing = 9.0,
this.minRowHeight = 60.0,
this.headerMaxLines = 1,
this.softWrapHeader = false,
this.showTableHeader = true,
this.tableWrapper,
this.leadingWidget,
Expand Down Expand Up @@ -108,6 +109,7 @@ class StandardTable<T> extends StatefulWidget {
final double? minRowHeight;

final int headerMaxLines;
final bool softWrapHeader;
final bool showTableHeader;
final bool hideLeadingTrailingWhenEmpty;

Expand Down Expand Up @@ -355,13 +357,15 @@ class _StandardTableState<T> extends State<StandardTable<T>> {
),
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)
Expand Down
1 change: 0 additions & 1 deletion designer_v2/lib/domain/study_monitoring.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ extension StudyMonitoringX on Study {
)
.map((p) => p.taskId)
.toSet();
print(progresses.toString());

final missedTaskIds = requiredTaskIds.difference(completedTaskIds);
missedTasksPerDay.add(missedTaskIds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
34 changes: 22 additions & 12 deletions designer_v2/lib/features/monitor/participant/participant_info.dart
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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}',
),
],
),
Expand All @@ -48,6 +57,7 @@ class ParticipantInfo extends ConsumerWidget {

Widget _buildInfoRow(String label, String value) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'$label: ',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -122,7 +121,6 @@ class ParticipantSquares extends StatelessWidget {
monitorItem.completedTasksPerDay.sublist(start, end)),
);
}

assert(
monitorItem.missedTasksPerDay.length ==
monitorItem.completedTasksPerDay.length,
Expand All @@ -136,13 +134,9 @@ class StudyPhase {
final List<Set<String>> missedTasksPerDay;
final List<Set<String>> 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,
});
}
1 change: 1 addition & 0 deletions designer_v2/lib/features/monitor/study_monitor_table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class StudyMonitorTable extends ConsumerWidget {
rowSpacing: 5.0,
minRowHeight: 30.0,
headerMaxLines: 2,
softWrapHeader: true,
onSelectItem: onSelectItem,
);
}
Expand Down
6 changes: 3 additions & 3 deletions designer_v2/lib/localization/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -572,14 +572,14 @@
"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",
"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",
Expand Down
6 changes: 3 additions & 3 deletions designer_v2/lib/localization/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -572,14 +572,14 @@
"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",
"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",
Expand Down

0 comments on commit bcb8000

Please sign in to comment.