mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-15 17:09:56 +00:00
Improved Season Support
This fixes issues with date range editing in the Metrics controls and provides support for Season load planning (under development). Creating and selecting seasons is largely managed within the Metrics tool. This has not been changed with this patch. Athlete seasons are now managed as a member of the MainWindow class (although this will move to an Athlete/Cyclist class when MainWindow is refactored). A Season identifier (UUID) has been introduced to enable Seasons to be referenced independently of their name or date ranges. The LTM tool now keeps track of changes to Seasons (when new seasons are created, changed, deleted). Additionally, the Season XML file now supports storage of a Season Load Plan.
This commit is contained in:
@@ -37,8 +37,14 @@ bool SeasonParser::endElement( const QString&, const QString&, const QString &qN
|
||||
season.setEnd(seasonDateToDate(buffer.trimmed()));
|
||||
else if (qName == "type")
|
||||
season.setType(buffer.trimmed().toInt());
|
||||
else if(qName == "season")
|
||||
{
|
||||
else if (qName == "id")
|
||||
season.setId(QUuid(buffer.trimmed()));
|
||||
else if (qName == "load") {
|
||||
season.load().resize(loadcount+1);
|
||||
season.load()[loadcount] = buffer.trimmed().toInt();
|
||||
loadcount++;
|
||||
} else if(qName == "season") {
|
||||
|
||||
if(seasons.size() >= 1) {
|
||||
// only set end date for previous season if
|
||||
// it is not null
|
||||
@@ -53,8 +59,10 @@ bool SeasonParser::endElement( const QString&, const QString&, const QString &qN
|
||||
bool SeasonParser::startElement( const QString&, const QString&, const QString &name, const QXmlAttributes & )
|
||||
{
|
||||
buffer.clear();
|
||||
if(name == "season")
|
||||
if(name == "season") {
|
||||
season = Season();
|
||||
loadcount = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -115,16 +123,25 @@ SeasonParser::serialize(QString filename, QList<Season>Seasons)
|
||||
// write out to file
|
||||
foreach (Season season, Seasons) {
|
||||
if (season.getType() != Season::temporary) {
|
||||
|
||||
// main attributes
|
||||
out<<QString("\t<season>\n"
|
||||
"\t\t<name>%1</name>\n"
|
||||
"\t\t<startdate>%2</startdate>\n"
|
||||
"\t\t<enddate>%3</enddate>\n"
|
||||
"\t\t<type>%4</type>\n"
|
||||
"\t</season>\n")
|
||||
.arg(season.getName())
|
||||
.arg(season.getStart().toString("yyyy-MM-dd"))
|
||||
.arg(season.getEnd().toString("yyyy-MM-dd"))
|
||||
.arg(season.getType());
|
||||
"\t\t<id>%5</id>\n") .arg(season.getName())
|
||||
.arg(season.getStart().toString("yyyy-MM-dd"))
|
||||
.arg(season.getEnd().toString("yyyy-MM-dd"))
|
||||
.arg(season.getType())
|
||||
.arg(season.id().toString());
|
||||
|
||||
|
||||
// load profile
|
||||
for (int i=9; i<season.load().count(); i++)
|
||||
out <<QString("\t<load>%1</load>\n").arg(season.load()[i]);
|
||||
|
||||
out <<QString("\t</season>\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user