correction ActivityInfo
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
6388591ee0
commit
a4f387e3cd
@ -1,35 +0,0 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:smartfit_app_mobile/modele/activity_info/activity_info.dart';
|
||||
|
||||
class ActivityInfoGeneric extends ActivityInfo {
|
||||
ActivityInfoGeneric.fromJson(super.map) : super.fromJson();
|
||||
ActivityInfoGeneric() : super.fromJson(null);
|
||||
|
||||
// ------- Ajout --------- //
|
||||
|
||||
// ------- Activity Info -------- //
|
||||
@override
|
||||
ActivityInfo getData(List<List<String>> csv) {
|
||||
super.getData(csv);
|
||||
return this;
|
||||
}
|
||||
|
||||
@override
|
||||
// Méthode pour convertir les attributs en JSON
|
||||
String toJson() {
|
||||
Map<String, dynamic> jsonMap = {
|
||||
'bpmAvg': bpmAvg,
|
||||
'bpmMax': bpmMax,
|
||||
'bpmMin': bpmMin,
|
||||
'startTime': startTime,
|
||||
'timeOfActivity': timeOfActivity,
|
||||
};
|
||||
return jsonEncode(jsonMap);
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toMap() {
|
||||
return {};
|
||||
}
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:smartfit_app_mobile/modele/activity_info/activity_info.dart';
|
||||
|
||||
class ActivityInfoWalking extends ActivityInfo {
|
||||
ActivityInfoWalking.fromJson(map) : super.fromJson(map) {
|
||||
deniveleNegatif = map["deniveleNegatif"].toDouble();
|
||||
denivelePositif = map["denivelePositif"].toDouble();
|
||||
}
|
||||
ActivityInfoWalking() : super.fromJson(null);
|
||||
|
||||
// ------- Ajout --------- //
|
||||
|
||||
// -- Denivelé -- //
|
||||
double denivelePositif = 0.0;
|
||||
double deniveleNegatif = 0.0;
|
||||
|
||||
@override
|
||||
ActivityInfo getData(List<List<String>> csv) {
|
||||
super.getData(csv);
|
||||
|
||||
Map<String, int> enteteCSV = getEntete(csv.first);
|
||||
// -- Denivelé -- //
|
||||
double lastDenivele = 0.0;
|
||||
|
||||
// -- Lecture du corps -- //
|
||||
for (int i = 1; i < csv.length; i++) {
|
||||
// -- Denivele -- //
|
||||
if (!isNull(enteteCSV["Value_${managerFile.fieldAltitude}"]!, csv[i])) {
|
||||
double value = double.parse(
|
||||
csv[i][enteteCSV["Value_${managerFile.fieldAltitude}"]!]);
|
||||
if (value > lastDenivele) {
|
||||
denivelePositif += value - lastDenivele;
|
||||
} else {
|
||||
deniveleNegatif += (value - lastDenivele) * -1;
|
||||
}
|
||||
lastDenivele = value;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@override
|
||||
// Méthode pour convertir les attributs en JSON
|
||||
String toJson() {
|
||||
Map<String, dynamic> jsonMap = {
|
||||
// Unique
|
||||
'denivelePositif': denivelePositif,
|
||||
'deniveleNegatif': deniveleNegatif,
|
||||
// All
|
||||
'bpmAvg': bpmAvg,
|
||||
'bpmMax': bpmMax,
|
||||
'bpmMin': bpmMin,
|
||||
// Ligne session
|
||||
'startTime': startTime,
|
||||
'timeOfActivity': timeOfActivity,
|
||||
};
|
||||
return jsonEncode(jsonMap);
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"DenivelePositif": denivelePositif,
|
||||
"DeniveleNegatif": denivelePositif
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Reference in new issue