Initialize Athlete Settings on REST API listAthletes

Required for cvalue to work
Fixes #3627
This commit is contained in:
Ale Martinez
2020-10-18 17:04:39 -03:00
parent d2a530e19e
commit ca191e3163

View File

@@ -175,7 +175,11 @@ APIWebService::listAthletes(HttpRequest &, HttpResponse &response)
// sure fire sign the athlete has been upgraded to post 3.2 and not some
// random directory full of other things & check something basic is set
QString ridedb = home.absolutePath() + "/" + name + "/cache/rideDB.json";
if (QFile(ridedb).exists() && appsettings->cvalue(name, GC_SEX, "") != "") {
if (QFile(ridedb).exists()) {
// we need to initialize athlete settings for cvalue to work
appsettings->initializeQSettingsAthlete(home.absolutePath(), name);
if (appsettings->cvalue(name, GC_SEX, "") == "") continue;
// we got one
QString line = name;
line += ", " + appsettings->cvalue(name, GC_DOB).toDate().toString("yyyy/MM/dd");