Generalize Body/Hrv Measures and add Nutrition data as example (#3564)

measures.ini is looked for in Athlete's config folder,
it should have a section for each measures group,
nutrition data with Energy and Macros is provided as example.
Moved default weight to About and removed RiderPhysPage and created
a tab for each measures group under Measures.
MeasuresPage handles conversion between metric and imperial units
Generalized CSV import with configurable headers.
MeasuresDownload enables download from Withings/Todays Plan only for Body
measures.
This is Part 1/2 of #2872
This commit is contained in:
Alejandro Martinez
2020-08-11 21:02:19 -03:00
committed by GitHub
parent 9a2d71dc5d
commit c52d260949
37 changed files with 919 additions and 2472 deletions

View File

@@ -630,19 +630,21 @@ APIWebService::listZones(QString athlete, QStringList, HttpRequest &request, Htt
void
APIWebService::listMeasures(QString athlete, QStringList paths, HttpRequest &request, HttpResponse &response)
{
QDir configDir(home.absolutePath() + "/" + athlete + "/config");
// list activities and associated metrics
response.setHeader("Content-Type", "text; charset=ISO-8859-1");
if (paths.isEmpty()) {
foreach (QString group, Measures().getGroupSymbols()) {
foreach (QString group, Measures(configDir).getGroupSymbols()) {
response.write(group.toLocal8Bit());
response.write("\n");
}
return;
}
Measures measures = Measures(QDir(home.absolutePath() + "/" + athlete + "/config"), true);
Measures measures = Measures(configDir, true);
int group_index = measures.getGroupSymbols().indexOf(paths[0]);
MeasuresGroup* measuresGroup = measures.getGroup(group_index);
if (group_index < 0 || measuresGroup == NULL) {