mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 00:28:42 +00:00
Merge pull request #1681 from Joern-R/traindb
TrainDB - fix //1 remove workout error
This commit is contained in:
@@ -356,9 +356,7 @@ GcUpgrade::upgrade(const QDir &home)
|
||||
|
||||
if (last < VERSION33_BUILD) {
|
||||
|
||||
// cleanup/restore default entries in the trainDB
|
||||
trainDB->updateDefaultEntries();
|
||||
|
||||
trainDB->upgradeDefaultEntriesWorkout();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -89,14 +89,6 @@ TrainDB::rebuildDB()
|
||||
createVideoSyncTable();
|
||||
}
|
||||
|
||||
bool
|
||||
TrainDB::updateDefaultEntries() {
|
||||
|
||||
bool rc1 = createDefaultEntriesWorkout();
|
||||
bool rc2 = createDefaultEntriesVideosync();
|
||||
return rc1 && rc2;
|
||||
}
|
||||
|
||||
|
||||
bool TrainDB::createVideoTable()
|
||||
{
|
||||
@@ -507,6 +499,27 @@ bool TrainDB::createDefaultEntriesWorkout()
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool TrainDB::upgradeDefaultEntriesWorkout()
|
||||
{
|
||||
|
||||
// set texts starting with " " in upgrade - since due to same translation errors the " " was lost e.g. in German
|
||||
QSqlQuery query(db->database(sessionid));
|
||||
bool rc;
|
||||
|
||||
// adding a space at the front of string to make manual mode always
|
||||
// appear first in a sorted list is a bit of a hack, but works ok
|
||||
QString manualErg = QString("UPDATE workouts SET filename = \"%1\" WHERE filepath = \"//1\";")
|
||||
.arg(" " + tr("Manual Erg Mode")); // keep the SPACE separate so that translation cannot remove it
|
||||
rc = query.exec(manualErg);
|
||||
|
||||
QString manualCrs = QString("UPDATE workouts SET filename = \"%1\" WHERE filepath = \"//2\";")
|
||||
.arg(" " + tr("Manual Slope Mode")); // keep the SPACE separate so that translation cannot remove it
|
||||
rc = query.exec(manualCrs);
|
||||
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool TrainDB::createDefaultEntriesVideosync()
|
||||
{
|
||||
QSqlQuery query(db->database(sessionid));
|
||||
|
||||
@@ -61,12 +61,12 @@ class TrainDB : public QObject
|
||||
bool importVideoSync(QString pathname, VideoSyncFile *videosyncFile);
|
||||
bool deleteVideoSync(QString pathname);
|
||||
|
||||
// for 3.3
|
||||
bool upgradeDefaultEntriesWorkout();
|
||||
|
||||
// drop and recreate tables
|
||||
void rebuildDB();
|
||||
|
||||
// update default entries in the tables
|
||||
bool updateDefaultEntries();
|
||||
|
||||
signals:
|
||||
void dataChanged();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user