Skip to content

Commit

Permalink
Fix relay XML export.
Browse files Browse the repository at this point in the history
https://github.com/international-orienteering-federation/datastandard-v3/blob/24eb108e4c6b5e2904e5f8f0e49142e45e2c5230/IOF.xsd#L2580
TeamMemberResult - One element per relay leg must be included, even if the team has not assigned any team member to the leg.
  • Loading branch information
arnost00 committed Oct 24, 2024
1 parent 117add3 commit aee9afe
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
7 changes: 7 additions & 0 deletions libquickevent/libquickeventcore/src/runstatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ class QUICKEVENTCORE_DECL_EXPORT RunStatus
QString toHtmlExportString() const;
QString toString() const;

void setDisqualifiedByOrganizer(bool value) { m_disqualifiedByOrganizer = value; }
void setNotCompeting(bool value) { m_notCompeting = value; }
void setMissingPunch(bool value) { m_missingPunch = value; }
void setDidNotStart(bool value) { m_didNotStart = value; }
void setDidNotFinish(bool value) { m_didNotFinish = value; }
void setOverTime(bool value) { m_overTime = value; }

bool isDisqualifiedByOrganizer() const { return m_disqualifiedByOrganizer; }
bool isNotCompeting() const { return m_notCompeting; }
bool isMissingPunch() const { return m_missingPunch; }
Expand Down
24 changes: 23 additions & 1 deletion quickevent/app/quickevent/plugins/Relays/src/relaysplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,29 @@ QString RelaysPlugin::resultsIofXml30()
const qf::core::utils::TreeTableRow tt_leg_row = tt_legs.row(k);
auto time = quickevent::core::og::TimeMs::fromVariant(tt_leg_row.value("time"));
// omit from export if leg does not exist (rundId == 0) or runner with OK status did not finish yet
if (tt_leg_row.value("runId").toInt() == 0 || (time.isValid() && time.msec() == 0))
if (tt_leg_row.value("runId").toInt() == 0) {
// empty TeamMemberResult if leg does not exists - defined in IOF XML v3
// https://github.com/international-orienteering-federation/datastandard-v3/blob/24eb108e4c6b5e2904e5f8f0e49142e45e2c5230/IOF.xsd#L2580
qfDebug() << "Empty LEG for : Leg " << k+1 << ", Bib " << QString::number(relay_number) + '.' + QString::number(k+1);
QVariantList member_result{"TeamMemberResult"};
QVariantList person_result{"Result"};
append_list(person_result, QVariantList{"Leg", k+1 } );
append_list(person_result, QVariantList{"BibNumber", QString::number(relay_number) + '.' + QString::number(k+1)});
quickevent::core::RunStatus dns;
dns.setDidNotStart(true);
append_list(person_result, QVariantList{"Status", dns.toXmlExportString()});
QVariantList overall_result{"OverallResult"};
{
quickevent::core::RunStatus dnf;
dnf.setDidNotFinish(true);
append_list(overall_result, QVariantList{"Status", dnf.toXmlExportString()});
}
append_list(person_result, overall_result);
append_list(member_result, person_result);
append_list(team_result, member_result);
continue;
}
else if (time.isValid() && time.msec() == 0)
continue;
QVariantList member_result{"TeamMemberResult"};
QVariantList person{"Person"};
Expand Down

0 comments on commit aee9afe

Please sign in to comment.