mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-15 00:49:55 +00:00
Measures CSV import - allow values in sexagesimal format
Initial use case is sleep_time from HRV4Training [publish binaries]
This commit is contained in:
@@ -170,7 +170,18 @@ MeasuresCsvImport::getMeasures(MeasuresGroup *measuresGroup, QString &error, QDa
|
||||
} else {
|
||||
for (int k=0; k<fieldCount; k++)
|
||||
if (measuresGroup->getFieldHeaders(k).contains(h)) {
|
||||
m.values[k] = i.toDouble(&ok);
|
||||
if (i.contains(":")) {
|
||||
// sexagesimal format
|
||||
double f = 1.0;
|
||||
foreach (QString s, i.split(":")) {
|
||||
m.values[k] += s.toDouble(&ok) / f;
|
||||
if (!ok) break;
|
||||
f *= 60;
|
||||
}
|
||||
} else {
|
||||
// decimal format
|
||||
m.values[k] = i.toDouble(&ok);
|
||||
}
|
||||
if (!ok) {
|
||||
error = tr("Invalid '%1' - in line %2")
|
||||
.arg(measuresGroup->getFieldHeaders(k).join("/"))
|
||||
|
||||
Reference in New Issue
Block a user