|
@@ -89,13 +89,6 @@ class ApiHrvReportDataSource implements HrvReportDataSource { |
|
@@ -89,13 +89,6 @@ class ApiHrvReportDataSource implements HrvReportDataSource { |
|
89
|
for (final trend in data.hrvTrendList ?? const <HrvTrendList>[])
|
89
|
for (final trend in data.hrvTrendList ?? const <HrvTrendList>[])
|
|
90
|
if (_parseApiDate(trend.timeKey) case final date?) date: trend,
|
90
|
if (_parseApiDate(trend.timeKey) case final date?) date: trend,
|
|
91
|
};
|
91
|
};
|
|
92
|
- final levelsByDate = <DateTime, HrvStressLevel>{
|
|
|
|
93
|
- for (final item
|
|
|
|
94
|
- in data.dailyDistributionList ?? const <DailyDistributionList>[])
|
|
|
|
95
|
- if (_parseApiDate(item.date) case final date?)
|
|
|
|
96
|
- if (_stressLevelFromApiId(item.hrvLevel) case final level?)
|
|
|
|
97
|
- date: level,
|
|
|
|
98
|
- };
|
|
|
|
99
|
final distributionCounts = _distributionCounts(data.hrvDistributionList);
|
92
|
final distributionCounts = _distributionCounts(data.hrvDistributionList);
|
|
100
|
final previousDistributionCounts =
|
93
|
final previousDistributionCounts =
|
|
101
|
_previousDistributionCounts(data.qoqHrvDistributionList);
|
94
|
_previousDistributionCounts(data.qoqHrvDistributionList);
|
|
@@ -107,15 +100,23 @@ class ApiHrvReportDataSource implements HrvReportDataSource { |
|
@@ -107,15 +100,23 @@ class ApiHrvReportDataSource implements HrvReportDataSource { |
|
107
|
_dayReport(
|
100
|
_dayReport(
|
|
108
|
weekStart.add(Duration(days: i)),
|
101
|
weekStart.add(Duration(days: i)),
|
|
109
|
trendsByDate,
|
102
|
trendsByDate,
|
|
110
|
- levelsByDate,
|
103
|
+ const <DateTime, HrvStressLevel>{},
|
|
111
|
),
|
104
|
),
|
|
112
|
],
|
105
|
],
|
|
113
|
previousRelaxedDays: _relaxedDays(previousDistributionCounts),
|
106
|
previousRelaxedDays: _relaxedDays(previousDistributionCounts),
|
|
114
|
previousStressedDays: _stressedDays(previousDistributionCounts),
|
107
|
previousStressedDays: _stressedDays(previousDistributionCounts),
|
|
115
|
distributionCounts:
|
108
|
distributionCounts:
|
|
116
|
distributionCounts.isEmpty ? null : distributionCounts,
|
109
|
distributionCounts.isEmpty ? null : distributionCounts,
|
|
117
|
- minDayOverride: _extremeDay(data.hrvMin, trendsByDate, levelsByDate),
|
|
|
|
118
|
- maxDayOverride: _extremeDay(data.hrvMax, trendsByDate, levelsByDate),
|
110
|
+ minDayOverride: _extremeDay(
|
|
|
|
111
|
+ data.hrvMin,
|
|
|
|
112
|
+ trendsByDate,
|
|
|
|
113
|
+ const <DateTime, HrvStressLevel>{},
|
|
|
|
114
|
+ ),
|
|
|
|
115
|
+ maxDayOverride: _extremeDay(
|
|
|
|
116
|
+ data.hrvMax,
|
|
|
|
117
|
+ trendsByDate,
|
|
|
|
118
|
+ const <DateTime, HrvStressLevel>{},
|
|
|
|
119
|
+ ),
|
|
119
|
);
|
120
|
);
|
|
120
|
}
|
121
|
}
|
|
121
|
|
122
|
|
|
@@ -127,13 +128,6 @@ class ApiHrvReportDataSource implements HrvReportDataSource { |
|
@@ -127,13 +128,6 @@ class ApiHrvReportDataSource implements HrvReportDataSource { |
|
127
|
for (final trend in data.hrvTrendList ?? const <HrvTrendList>[])
|
128
|
for (final trend in data.hrvTrendList ?? const <HrvTrendList>[])
|
|
128
|
if (_parseApiDate(trend.timeKey) case final date?) date: trend,
|
129
|
if (_parseApiDate(trend.timeKey) case final date?) date: trend,
|
|
129
|
};
|
130
|
};
|
|
130
|
- final levelsByDate = <DateTime, HrvStressLevel>{
|
|
|
|
131
|
- for (final item
|
|
|
|
132
|
- in data.dailyDistributionList ?? const <DailyDistributionList>[])
|
|
|
|
133
|
- if (_parseApiDate(item.date) case final date?)
|
|
|
|
134
|
- if (_stressLevelFromApiId(item.hrvLevel) case final level?)
|
|
|
|
135
|
- date: level,
|
|
|
|
136
|
- };
|
|
|
|
137
|
final distributionCounts = _distributionCounts(data.hrvDistributionList);
|
131
|
final distributionCounts = _distributionCounts(data.hrvDistributionList);
|
|
138
|
final previousDistributionCounts =
|
132
|
final previousDistributionCounts =
|
|
139
|
_previousDistributionCounts(data.qoqHrvDistributionList);
|
133
|
_previousDistributionCounts(data.qoqHrvDistributionList);
|
|
@@ -146,15 +140,23 @@ class ApiHrvReportDataSource implements HrvReportDataSource { |
|
@@ -146,15 +140,23 @@ class ApiHrvReportDataSource implements HrvReportDataSource { |
|
146
|
_dayReport(
|
140
|
_dayReport(
|
|
147
|
monthStart.add(Duration(days: i)),
|
141
|
monthStart.add(Duration(days: i)),
|
|
148
|
trendsByDate,
|
142
|
trendsByDate,
|
|
149
|
- levelsByDate,
|
143
|
+ const <DateTime, HrvStressLevel>{},
|
|
150
|
),
|
144
|
),
|
|
151
|
],
|
145
|
],
|
|
152
|
previousRelaxedDays: _relaxedDays(previousDistributionCounts),
|
146
|
previousRelaxedDays: _relaxedDays(previousDistributionCounts),
|
|
153
|
previousStressedDays: _stressedDays(previousDistributionCounts),
|
147
|
previousStressedDays: _stressedDays(previousDistributionCounts),
|
|
154
|
distributionCounts:
|
148
|
distributionCounts:
|
|
155
|
distributionCounts.isEmpty ? null : distributionCounts,
|
149
|
distributionCounts.isEmpty ? null : distributionCounts,
|
|
156
|
- minDayOverride: _extremeDay(data.hrvMin, trendsByDate, levelsByDate),
|
|
|
|
157
|
- maxDayOverride: _extremeDay(data.hrvMax, trendsByDate, levelsByDate),
|
150
|
+ minDayOverride: _extremeDay(
|
|
|
|
151
|
+ data.hrvMin,
|
|
|
|
152
|
+ trendsByDate,
|
|
|
|
153
|
+ const <DateTime, HrvStressLevel>{},
|
|
|
|
154
|
+ ),
|
|
|
|
155
|
+ maxDayOverride: _extremeDay(
|
|
|
|
156
|
+ data.hrvMax,
|
|
|
|
157
|
+ trendsByDate,
|
|
|
|
158
|
+ const <DateTime, HrvStressLevel>{},
|
|
|
|
159
|
+ ),
|
|
158
|
);
|
160
|
);
|
|
159
|
}
|
161
|
}
|
|
160
|
|
162
|
|
|
@@ -213,6 +215,7 @@ class ApiHrvReportDataSource implements HrvReportDataSource { |
|
@@ -213,6 +215,7 @@ class ApiHrvReportDataSource implements HrvReportDataSource { |
|
213
|
averageHeartRate: trend?.hrAverage?.round(),
|
215
|
averageHeartRate: trend?.hrAverage?.round(),
|
|
214
|
lastRestingHrValue: trend?.lastRestingHrValue,
|
216
|
lastRestingHrValue: trend?.lastRestingHrValue,
|
|
215
|
comprehensiveStressScore: trend?.comprehensiveStressScore?.toDouble(),
|
217
|
comprehensiveStressScore: trend?.comprehensiveStressScore?.toDouble(),
|
|
|
|
218
|
+ trendLevel: trendLevel,
|
|
216
|
level: level,
|
219
|
level: level,
|
|
217
|
);
|
220
|
);
|
|
218
|
}
|
221
|
}
|