MeOS version 3.5.978 Update 3
This commit is contained in:
parent
ef53f6da74
commit
6119dc88f1
@ -2361,7 +2361,7 @@ void TabCompetition::copyrightLine(gdioutput &gdi) const
|
||||
|
||||
gdi.dropLine(0.4);
|
||||
gdi.fillDown();
|
||||
gdi.addString("", 0, makeDash(L"#Copyright © 2007-2018 Melin Software HB"));
|
||||
gdi.addString("", 0, makeDash(L"#Copyright © 2007-2019 Melin Software HB"));
|
||||
gdi.dropLine(1);
|
||||
gdi.popX();
|
||||
|
||||
@ -2374,7 +2374,7 @@ void TabCompetition::loadAboutPage(gdioutput &gdi) const
|
||||
gdi.clearPage(false);
|
||||
gdi.addString("", 2, makeDash(L"Om MeOS - ett Mycket Enkelt OrienteringsSystem")).setColor(colorDarkBlue);
|
||||
gdi.dropLine(2);
|
||||
gdi.addStringUT(1, makeDash(L"Copyright © 2007-2018 Melin Software HB"));
|
||||
gdi.addStringUT(1, makeDash(L"Copyright © 2007-2019 Melin Software HB"));
|
||||
gdi.dropLine();
|
||||
gdi.addStringUT(10, "The database connection used is MySQL++\nCopyright "
|
||||
"(c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by MySQL AB,"
|
||||
|
||||
@ -3684,8 +3684,8 @@ oClub *TabSI::extractClub(gdioutput &gdi) const {
|
||||
oClub *dbClub = nullptr;
|
||||
if (gdi.hasField("Club")) {
|
||||
int clubId = gdi.getExtraInt("Club");
|
||||
if (clubId >= 0) {
|
||||
dbClub = db.getClub(clubId);
|
||||
if (clubId > 0) {
|
||||
dbClub = db.getClub(clubId-1);
|
||||
if (dbClub && !stringMatch(dbClub->getName(), gdi.getText("Club")))
|
||||
dbClub = nullptr;
|
||||
}
|
||||
@ -3702,8 +3702,8 @@ RunnerWDBEntry *TabSI::extractRunner(gdioutput &gdi) const {
|
||||
int rId = gdi.getExtraInt("Name");
|
||||
wstring name = gdi.getText("Name");
|
||||
RunnerWDBEntry *dbR = nullptr;
|
||||
if (rId >= 0) {
|
||||
dbR = db.getRunnerByIndex(rId);
|
||||
if (rId > 0) {
|
||||
dbR = db.getRunnerByIndex(rId-1);
|
||||
if (dbR) {
|
||||
wstring fname = dbR->getFamilyName();
|
||||
wstring gname = dbR->getGivenName();
|
||||
@ -3847,8 +3847,9 @@ void TabSI::handleAutoComplete(gdioutput &gdi, AutoCompleteInfo &info) {
|
||||
auto bi = gdi.setText(info.getTarget(), info.getCurrent().c_str());
|
||||
if (bi) {
|
||||
int ix = info.getCurrentInt();
|
||||
bi->setExtra(ix);
|
||||
if (bi->id == "Name") {
|
||||
|
||||
bi->setExtra(ix+1);
|
||||
if (bi->id == "Name" && ix >= 0) {
|
||||
auto r = oe->getRunnerDatabase().getRunnerByIndex(ix);
|
||||
int year = r ? r->getBirthYear() : 0;
|
||||
if (year > 0) {
|
||||
|
||||
@ -888,7 +888,7 @@ void csvparser::checkSIConfigHeader(const vector<wstring> &sp) {
|
||||
else if (key == L"First name") {
|
||||
siconfigmap[sicFirstName] = k;
|
||||
}
|
||||
else if (key == L"Last name") {
|
||||
else if (key == L"Last name" || key == L"name") {
|
||||
siconfigmap[sicLastName] = k;
|
||||
}
|
||||
else if (key == L"No. of records" || key == L"No. of punches") {
|
||||
|
||||
@ -287,7 +287,8 @@ void Download::postFile(const wstring &url, const wstring &file, const wstring &
|
||||
|
||||
InternetCrackUrl(url.c_str(), url.length(), ICU_ESCAPE, &uc);
|
||||
int port = INTERNET_DEFAULT_HTTP_PORT;
|
||||
if (uc.nScheme == INTERNET_SCHEME_HTTPS)
|
||||
bool https = uc.nScheme == INTERNET_SCHEME_HTTPS;
|
||||
if (https)
|
||||
port = INTERNET_DEFAULT_HTTPS_PORT;
|
||||
else if (uc.nPort>0)
|
||||
port = uc.nPort;
|
||||
@ -296,7 +297,7 @@ void Download::postFile(const wstring &url, const wstring &file, const wstring &
|
||||
bool vsuccess = false;
|
||||
int errorCode = 0;
|
||||
try {
|
||||
vsuccess = httpSendReqEx(hConnect, path, headers, file, fileOut, pw, errorCode);
|
||||
vsuccess = httpSendReqEx(hConnect, https, path, headers, file, fileOut, pw, errorCode);
|
||||
}
|
||||
catch (std::exception &) {
|
||||
InternetCloseHandle(hConnect);
|
||||
@ -315,7 +316,7 @@ void Download::postFile(const wstring &url, const wstring &file, const wstring &
|
||||
}
|
||||
}
|
||||
|
||||
bool Download::httpSendReqEx(HINTERNET hConnect, const wstring &dest,
|
||||
bool Download::httpSendReqEx(HINTERNET hConnect, bool https, const wstring &dest,
|
||||
const vector< pair<wstring, wstring> > &headers,
|
||||
const wstring &upFile, const wstring &outFile,
|
||||
ProgressWindow &pw,
|
||||
@ -324,8 +325,19 @@ bool Download::httpSendReqEx(HINTERNET hConnect, const wstring &dest,
|
||||
INTERNET_BUFFERS BufferIn;
|
||||
memset(&BufferIn, 0, sizeof(BufferIn));
|
||||
BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS );
|
||||
TCHAR szAccept[] = L"*/*";
|
||||
LPCTSTR AcceptTypes[2] = { 0, 0 };
|
||||
AcceptTypes[0] = szAccept;
|
||||
DWORD flags = INTERNET_FLAG_NO_CACHE_WRITE |
|
||||
INTERNET_FLAG_IGNORE_CERT_DATE_INVALID |
|
||||
INTERNET_FLAG_IGNORE_CERT_CN_INVALID |
|
||||
INTERNET_FLAG_KEEP_CONNECTION;
|
||||
|
||||
HINTERNET hRequest = HttpOpenRequest (hConnect, L"POST", dest.c_str(), NULL, NULL, NULL, INTERNET_FLAG_NO_CACHE_WRITE, 0);
|
||||
if (https)
|
||||
flags |= INTERNET_FLAG_SECURE;
|
||||
|
||||
HINTERNET hRequest = HttpOpenRequest (hConnect, L"POST", dest.c_str(), HTTP_VERSION, NULL, AcceptTypes,
|
||||
flags, 0);
|
||||
|
||||
DWORD dwBytesRead = 0;
|
||||
DWORD dwBytesWritten = 0;
|
||||
@ -397,11 +409,14 @@ bool Download::httpSendReqEx(HINTERNET hConnect, const wstring &dest,
|
||||
errorCode = error;
|
||||
if (error == ERROR_INTERNET_FORCE_RETRY)
|
||||
retry--;
|
||||
else if (error == ERROR_INTERNET_TIMEOUT) {
|
||||
throw std::exception("Fick inget svar i tid (ERROR_INTERNET_TIMEOUT)");
|
||||
}
|
||||
else {
|
||||
InternetCloseHandle(hRequest);
|
||||
if (error == ERROR_INTERNET_TIMEOUT) {
|
||||
throw std::exception("Fick inget svar i tid (ERROR_INTERNET_TIMEOUT)");
|
||||
}
|
||||
else if (error == ERROR_INTERNET_CONNECTION_RESET) {
|
||||
throw std::exception("Inget svar (ERROR_INTERNET_CONNECTION_RESET)");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ private:
|
||||
bool success;
|
||||
void initThread();
|
||||
|
||||
bool httpSendReqEx(HINTERNET hConnect, const wstring &dest, const vector< pair<wstring, wstring> > &headers,
|
||||
bool httpSendReqEx(HINTERNET hConnect, bool https, const wstring &dest, const vector< pair<wstring, wstring> > &headers,
|
||||
const wstring &upFile, const wstring &outFile, ProgressWindow &pw, int &errroCode) const;
|
||||
|
||||
public:
|
||||
|
||||
@ -1329,6 +1329,7 @@ void DynamicResult::debugDumpVariables(gdioutput &gdi, bool includeSymbols) cons
|
||||
void GeneralResult::calculateIndividualResults(vector<pRunner> &runners,
|
||||
const pair<int, int> & controlId,
|
||||
bool totalResults,
|
||||
bool inclForestRunners,
|
||||
const string &resTag,
|
||||
oListInfo::ResultType resType,
|
||||
int inputNumber,
|
||||
@ -1347,10 +1348,19 @@ void GeneralResult::calculateIndividualResults(vector<pRunner> &runners,
|
||||
for (pRunner r : runners) {
|
||||
ri.status = r->getStatus();
|
||||
if (ri.status == StatusUnknown) {
|
||||
if (r->getFinishTime() == 0)
|
||||
if (r->getFinishTime() == 0) {
|
||||
if (!inclForestRunners)
|
||||
continue;
|
||||
else {
|
||||
if (r->getClubId() == cVacantId)
|
||||
continue;
|
||||
ri.status = StatusUnknown;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ri.status = StatusOK; // Preliminary status
|
||||
}
|
||||
}
|
||||
if (ri.status == StatusOK)
|
||||
ri.place = r->getPlace();
|
||||
else
|
||||
@ -1367,10 +1377,19 @@ void GeneralResult::calculateIndividualResults(vector<pRunner> &runners,
|
||||
for (pRunner r : runners) {
|
||||
ri.status = r->getTotalStatus();
|
||||
if (ri.status == StatusUnknown && r->getInputStatus() == StatusOK) {
|
||||
if (r->getFinishTime() == 0)
|
||||
if (r->getFinishTime() == 0) {
|
||||
if (!inclForestRunners)
|
||||
continue;
|
||||
else {
|
||||
if (r->getClubId() == cVacantId)
|
||||
continue;
|
||||
ri.status = StatusUnknown;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ri.status = StatusOK; // Preliminary status
|
||||
}
|
||||
}
|
||||
if (ri.status == StatusOK)
|
||||
ri.place = r->getTotalPlace();
|
||||
else
|
||||
@ -1439,8 +1458,11 @@ void GeneralResult::calculateIndividualResults(vector<pRunner> &runners,
|
||||
const auto &tmp = r->getTempResult(0);
|
||||
ri.status = tmp.getStatus();
|
||||
if (ri.status == StatusUnknown) {
|
||||
if (r->getFinishTime() == 0)
|
||||
if (r->getFinishTime() == 0) {
|
||||
if (!inclForestRunners)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
ri.status = StatusOK; // Preliminary status
|
||||
}
|
||||
if (ri.status == StatusOK)
|
||||
@ -1450,6 +1472,7 @@ void GeneralResult::calculateIndividualResults(vector<pRunner> &runners,
|
||||
|
||||
if ((controlId.first != oPunch::PunchStart ||
|
||||
controlId.second != oPunch::PunchFinish) && ri.status == StatusMP && r->getStatus() != StatusMP) {
|
||||
if (!inclForestRunners)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -122,6 +122,7 @@ public:
|
||||
static void calculateIndividualResults(vector<pRunner> &runners,
|
||||
const pair<int, int> &controlId,
|
||||
bool totalResults,
|
||||
bool inclForestRunners,
|
||||
const string &resTag,
|
||||
oListInfo::ResultType resType,
|
||||
int inputNumber,
|
||||
|
||||
@ -85,6 +85,9 @@ InfoRadioControl::InfoRadioControl(int id) : InfoBase(id) {
|
||||
InfoClass::InfoClass(int id) : InfoBase(id) {
|
||||
}
|
||||
|
||||
InfoMeosStatus::InfoMeosStatus() : InfoBase(0) {
|
||||
}
|
||||
|
||||
InfoOrganization::InfoOrganization(int id) : InfoBase(id) {
|
||||
}
|
||||
|
||||
@ -381,6 +384,23 @@ void InfoClass::serialize(xmlbuffer &xml, bool diffOnly) const {
|
||||
xml.write("cls", prop, name);
|
||||
}
|
||||
|
||||
void InfoMeosStatus::setOnDatabase(const bool flag) {
|
||||
onDatabase = flag;
|
||||
}
|
||||
|
||||
void InfoMeosStatus::setEventNameId(const wstring & str) {
|
||||
eventNameId = str;
|
||||
}
|
||||
|
||||
void InfoMeosStatus::serialize(xmlbuffer &xml, bool diffOnly) const {
|
||||
vector<pair<string, wstring>> prop;
|
||||
prop.push_back(make_pair("version", getMeosCompectVersion()));
|
||||
prop.push_back(make_pair("eventNameId", eventNameId));
|
||||
prop.push_back(make_pair("onDatabase", itow(onDatabase))); // 1 is true, 0 is false
|
||||
|
||||
xml.write("status", prop, L"");
|
||||
}
|
||||
|
||||
bool InfoOrganization::synchronize(oClub &c) {
|
||||
const wstring &n = c.getDisplayName();
|
||||
if (n == name)
|
||||
@ -445,6 +465,10 @@ bool InfoBaseCompetitor::synchronizeBase(oAbstractRunner &bc) {
|
||||
}
|
||||
|
||||
int s = bc.getStatus();
|
||||
int rt = bc.getRunningTime() * 10;
|
||||
if (rt > 0 && s == RunnerStatus::StatusUnknown)
|
||||
s = RunnerStatus::StatusOK;
|
||||
|
||||
if (status != s) {
|
||||
status = s;
|
||||
ch = true;
|
||||
@ -459,7 +483,6 @@ bool InfoBaseCompetitor::synchronizeBase(oAbstractRunner &bc) {
|
||||
ch = true;
|
||||
}
|
||||
|
||||
int rt = bc.getRunningTime() * 10;
|
||||
if (rt != runningTime) {
|
||||
runningTime = rt;
|
||||
ch = true;
|
||||
|
||||
@ -125,6 +125,18 @@ class InfoClass : public InfoBase {
|
||||
friend class InfoCompetition;
|
||||
};
|
||||
|
||||
class InfoMeosStatus : public InfoBase {
|
||||
protected:
|
||||
wstring eventNameId; // event Name Id, actual name of the database, can also be matched in oevent table of meosmain
|
||||
bool onDatabase; // true if currently on database
|
||||
public:
|
||||
void serialize(xmlbuffer &xml, bool diffOnly) const;
|
||||
InfoMeosStatus();
|
||||
virtual ~InfoMeosStatus() {}
|
||||
void setEventNameId(const wstring &);
|
||||
void setOnDatabase(const bool);
|
||||
};
|
||||
|
||||
class InfoOrganization : public InfoBase {
|
||||
protected:
|
||||
wstring name;
|
||||
|
||||
@ -1637,7 +1637,7 @@ pRunner IOF30Interface::readPersonEntry(gdioutput &gdi, xmlobject &xo, pTeam tea
|
||||
if (sar) {
|
||||
string type;
|
||||
sar.getObjectString("type", type);
|
||||
if (type == "groupedWithRef") {
|
||||
if (type == "groupedWithRef" || type == "GroupedWith") {
|
||||
xmlobject pRef = sar.getObject("Person");
|
||||
if (pRef) {
|
||||
wstring sid;
|
||||
@ -2655,7 +2655,7 @@ void IOF30Interface::writeResult(xmlparser &xml, const oRunner &rPerson, const o
|
||||
}
|
||||
|
||||
if (teamMember)
|
||||
writeLegOrder(xml, rPerson);
|
||||
writeLegOrder(xml, rPerson.getClassRef(false), rPerson.getLegNumber());
|
||||
|
||||
wstring bib = rPerson.getBib();
|
||||
if (!bib.empty())
|
||||
@ -3113,6 +3113,44 @@ void IOF30Interface::writePersonStart(xmlparser &xml, const oRunner &r, bool inc
|
||||
xml.endTag();
|
||||
}
|
||||
|
||||
void IOF30Interface::writeTeamNoPersonStart(xmlparser &xml, const oTeam &t, int leg, bool includeRaceNumber) {
|
||||
xml.startTag("TeamMemberStart");
|
||||
|
||||
const pClub pc = t.getClubRef();
|
||||
pClass cls = t.getClassRef(false);
|
||||
if (pc && !pc->isVacant())
|
||||
writeClub(xml, *pc, false);
|
||||
|
||||
{
|
||||
if (!includeRaceNumber || (getStageNumber() == 0 && (cls && cls->getLegRunnerIndex(leg)==0)))
|
||||
xml.startTag("Start");
|
||||
else {
|
||||
int rn = getStageNumber();
|
||||
if (rn == 0)
|
||||
rn = 1;
|
||||
if (includeStageRaceInfo)
|
||||
rn += cls->getLegRunnerIndex(leg);
|
||||
|
||||
xml.startTag("Start", "raceNumber", itos(rn));
|
||||
}
|
||||
|
||||
writeLegOrder(xml, cls, leg);
|
||||
|
||||
wstring bib = t.getBib();
|
||||
if (!bib.empty())
|
||||
xml.write("BibNumber", bib);
|
||||
int startTime = 0;
|
||||
if (cls && cls->getStartType(leg) == StartTypes::STTime)
|
||||
startTime = cls->getStartData(leg);
|
||||
if (startTime > 0)
|
||||
xml.write("StartTime", oe.getAbsDateTimeISO(startTime, true, useGMT));
|
||||
|
||||
xml.endTag();
|
||||
}
|
||||
|
||||
xml.endTag();
|
||||
}
|
||||
|
||||
void IOF30Interface::writeTeamStart(xmlparser &xml, const oTeam &t) {
|
||||
xml.startTag("TeamStart");
|
||||
|
||||
@ -3126,9 +3164,13 @@ void IOF30Interface::writeTeamStart(xmlparser &xml, const oTeam &t) {
|
||||
if (!bib.empty())
|
||||
xml.write("BibNumber", bib);
|
||||
|
||||
pClass cls = t.getClassRef(false);
|
||||
|
||||
for (int k = 0; k < t.getNumRunners(); k++) {
|
||||
if (t.getRunner(k))
|
||||
writePersonStart(xml, *t.getRunner(k), true, true);
|
||||
else if (cls && !cls->isOptional(k))
|
||||
writeTeamNoPersonStart(xml, t, k, includeStageRaceInfo);
|
||||
}
|
||||
|
||||
writeAssignedFee(xml, t, 0);
|
||||
@ -3150,7 +3192,7 @@ void IOF30Interface::writeStart(xmlparser &xml, const oRunner &r,
|
||||
xml.startTag("Start", "raceNumber", itos(rn));
|
||||
}
|
||||
if (teamMember)
|
||||
writeLegOrder(xml, r);
|
||||
writeLegOrder(xml, r.getClassRef(false), r.getLegNumber());
|
||||
|
||||
wstring bib = r.getBib();
|
||||
if (!bib.empty())
|
||||
@ -3171,12 +3213,11 @@ void IOF30Interface::writeStart(xmlparser &xml, const oRunner &r,
|
||||
xml.endTag();
|
||||
}
|
||||
|
||||
void IOF30Interface::writeLegOrder(xmlparser &xml, const oRunner &r) const {
|
||||
void IOF30Interface::writeLegOrder(xmlparser &xml, const oClass *pc, int legNo) const {
|
||||
// Team member race result
|
||||
int legNumber, legOrder;
|
||||
const oClass *pc = r.getClassRef(false);
|
||||
if (pc) {
|
||||
bool par = pc->splitLegNumberParallel(r.getLegNumber(), legNumber, legOrder);
|
||||
bool par = pc->splitLegNumberParallel(legNo, legNumber, legOrder);
|
||||
xml.write("Leg", legNumber + 1);
|
||||
if (par)
|
||||
xml.write("LegOrder", legOrder + 1);
|
||||
|
||||
@ -215,6 +215,8 @@ class IOF30Interface {
|
||||
|
||||
void writePersonStart(xmlparser &xml, const oRunner &r, bool includeCourse, bool teamMember);
|
||||
|
||||
void writeTeamNoPersonStart(xmlparser &xml, const oTeam &t, int leg, bool includeRaceNumber);
|
||||
|
||||
void writeTeamStart(xmlparser &xml, const oTeam &t);
|
||||
|
||||
void writeStart(xmlparser &xml, const oRunner &r, bool includeCourse,
|
||||
@ -222,7 +224,7 @@ class IOF30Interface {
|
||||
|
||||
|
||||
pCourse haveSameCourse(const vector<pRunner> &r) const;
|
||||
void writeLegOrder(xmlparser &xml, const oRunner &r) const;
|
||||
void writeLegOrder(xmlparser &xml, const oClass *pc, int legNo) const;
|
||||
|
||||
// Returns zero if no stage number
|
||||
int getStageNumber();
|
||||
|
||||
@ -27,9 +27,9 @@
|
||||
//V2: ABCDEFGHIHJKMN
|
||||
//V31: a
|
||||
//V33: abcde
|
||||
//V35: abcdef
|
||||
//V35: abcdefg
|
||||
int getMeosBuild() {
|
||||
string revision("$Rev: 742 $");
|
||||
string revision("$Rev: 804 $");
|
||||
return 174 + atoi(revision.substr(5, string::npos).c_str());
|
||||
}
|
||||
|
||||
@ -41,12 +41,12 @@ int getMeosBuild() {
|
||||
//V33: abcdefghij
|
||||
//V34: abcdfge
|
||||
wstring getMeosDate() {
|
||||
wstring date(L"$Date: 2018-08-04 08:53:52 +0200 (lö, 04 aug 2018) $");
|
||||
wstring date(L"$Date: 2019-01-07 21:22:06 +0100 (må, 07 jan 2019) $");
|
||||
return date.substr(7,10);
|
||||
}
|
||||
|
||||
wstring getBuildType() {
|
||||
return L"U2"; // No parantheses (...)
|
||||
return L"U3"; // No parantheses (...)
|
||||
}
|
||||
|
||||
wstring getMajorVersion() {
|
||||
@ -121,7 +121,6 @@ void getSupporters(vector<wstring> &supp, vector<wstring> developSupp)
|
||||
supp.emplace_back(L"Siguldas Takas, Latvia");
|
||||
supp.emplace_back(L"Eric Teutsch, Ottawa Orienteering Club, Canada");
|
||||
supp.emplace_back(L"Silkeborg OK, Denmark");
|
||||
supp.emplace_back(L"Almby IK, Örebro");
|
||||
supp.emplace_back(L"Erik Ivarsson Sandberg");
|
||||
supp.emplace_back(L"Stenungsunds OK");
|
||||
supp.emplace_back(L"OK Leipzig");
|
||||
@ -132,6 +131,14 @@ void getSupporters(vector<wstring> &supp, vector<wstring> developSupp)
|
||||
supp.emplace_back(L"Kamil Pipek, OK Lokomotiva Pardubice");
|
||||
supp.emplace_back(L"Richard HEYRIES");
|
||||
supp.emplace_back(L"Ingemar Carlsson");
|
||||
supp.emplace_back(L"Tolereds AIK");
|
||||
supp.emplace_back(L"OK Snab");
|
||||
supp.emplace_back(L"OK 73");
|
||||
supp.emplace_back(L"Helsingborgs SOK");
|
||||
supp.emplace_back(L"Sala OK");
|
||||
supp.emplace_back(L"OK Roskilde");
|
||||
supp.emplace_back(L"Almby IK, Örebro");
|
||||
supp.emplace_back(L"Ligue PACA");
|
||||
|
||||
reverse(supp.begin(), supp.end());
|
||||
}
|
||||
|
||||
@ -836,7 +836,7 @@ string oDataContainer::generateSQLSet(const oBase *ob, bool forceSetAll) const {
|
||||
ob->getDataBuffers(data, oldData, strptr);
|
||||
|
||||
string sql;
|
||||
char bf[256];
|
||||
char bf[1024*8];
|
||||
|
||||
for (size_t kk = 0; kk < ordered.size(); kk++) {
|
||||
const oDataInfo &di=ordered[kk];
|
||||
|
||||
@ -1208,7 +1208,14 @@ protected:
|
||||
bool addXMLTeamEntry(const xmlobject &xentry, int ClubId);
|
||||
bool addXMLClass(const xmlobject &xclub);
|
||||
bool addXMLClub(const xmlobject &xclub, bool importToDB);
|
||||
bool addXMLRank(const xmlobject &xrank, map<__int64, int> &externIdToRunnerId);
|
||||
// Fill in the output map. Set flag to true if match is made on id, false if on name.
|
||||
enum class RankStatus {
|
||||
IdMatch,
|
||||
NameMatch,
|
||||
Ambivalent
|
||||
};
|
||||
|
||||
bool addXMLRank(const xmlobject &xrank, const map<__int64, int> &externIdToRunnerId, map<int, pair<int, RankStatus>> &output);
|
||||
bool addXMLEvent(const xmlobject &xevent);
|
||||
|
||||
bool addXMLCourse(const xmlobject &xcourse, bool addClasses);
|
||||
|
||||
@ -492,23 +492,33 @@ void oEvent::importXML_EntryData(gdioutput &gdi, const wstring &file,
|
||||
xmlList xl;
|
||||
xo.getObjects(xl);
|
||||
|
||||
xmlList::const_iterator it;
|
||||
|
||||
map<__int64, int> ext2Id;
|
||||
for (oRunnerList::iterator it = Runners.begin(); it != Runners.end(); ++it) {
|
||||
for (auto it = Runners.begin(); it != Runners.end(); ++it) {
|
||||
if (it->skip())
|
||||
continue;
|
||||
__int64 ext = it->getExtIdentifier();
|
||||
if (ext != 0)
|
||||
ext2Id[ext] = it->getId();
|
||||
}
|
||||
|
||||
for(it=xl.begin(); it != xl.end(); ++it){
|
||||
map<int, pair<int, RankStatus>> rankList;
|
||||
for (auto it = xl.begin(); it != xl.end(); ++it) {
|
||||
if (it->is("Competitor")) {
|
||||
if (addXMLRank(*it, ext2Id))
|
||||
imp++;
|
||||
else
|
||||
addXMLRank(*it, ext2Id, rankList);
|
||||
}
|
||||
}
|
||||
for (auto it : rankList) {
|
||||
if (it.second.second == RankStatus::Ambivalent)
|
||||
fail++;
|
||||
else {
|
||||
pRunner r = getRunner(it.first, 0);
|
||||
if (r) {
|
||||
r->getDI().setInt("Rank", it.second.first);
|
||||
r->synchronize();
|
||||
imp++;
|
||||
}
|
||||
else {
|
||||
fail++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1734,7 +1744,8 @@ bool oEvent::addXMLClub(const xmlobject &xclub, bool savetoDB)
|
||||
}
|
||||
|
||||
|
||||
bool oEvent::addXMLRank(const xmlobject &xrank, map<__int64, int> &externIdToRunnerId)
|
||||
bool oEvent::addXMLRank(const xmlobject &xrank, const map<__int64, int> &externIdToRunnerId,
|
||||
map<int, pair<int, oEvent::RankStatus>> &output)
|
||||
{
|
||||
if (!xrank)
|
||||
return false;
|
||||
@ -1757,10 +1768,10 @@ bool oEvent::addXMLRank(const xmlobject &xrank, map<__int64, int> &externIdToRun
|
||||
else if (cit->is("Club"))
|
||||
club=*cit;
|
||||
else if (cit->is("Rank")){
|
||||
if (cit->getObjectString("Name", tmp)=="Swedish Ranking List")
|
||||
rank=*cit;
|
||||
else if (cit->getObjectString("Name", tmp)=="Swedish Vacancy List")
|
||||
if (cit->getObjectString("Name", tmp).find("Vacancy") != string::npos)
|
||||
vrank=*cit;
|
||||
else
|
||||
rank = *cit;
|
||||
}
|
||||
++cit;
|
||||
}
|
||||
@ -1771,12 +1782,14 @@ bool oEvent::addXMLRank(const xmlobject &xrank, map<__int64, int> &externIdToRun
|
||||
person.getObjectString("PersonId", pid);
|
||||
const __int64 extId = oBase::converExtIdentifierString(pid);
|
||||
int id = oBase::idFromExtId(extId);
|
||||
if (externIdToRunnerId.count(extId))
|
||||
id = externIdToRunnerId[extId];
|
||||
auto res = externIdToRunnerId.find(extId);
|
||||
if (res != externIdToRunnerId.end())
|
||||
id = res->second;
|
||||
|
||||
pRunner r = getRunner(id, 0);
|
||||
bool idMatch = r != nullptr;
|
||||
|
||||
if (!r){
|
||||
if (r == nullptr){
|
||||
xmlobject pname = person.getObject("PersonName");
|
||||
|
||||
if (!pname) return false;
|
||||
@ -1803,15 +1816,26 @@ bool oEvent::addXMLRank(const xmlobject &xrank, map<__int64, int> &externIdToRun
|
||||
|
||||
if (!r) return false; //No runner here!
|
||||
|
||||
oDataInterface DI=r->getDI();
|
||||
if (rank) {
|
||||
int pos = rank.getObjectInt("RankPosition");
|
||||
if (idMatch)
|
||||
output[r->getId()] = make_pair(pos, RankStatus::IdMatch);
|
||||
else {
|
||||
auto ores = output.find(r->getId());
|
||||
if (ores == output.end())
|
||||
output[r->getId()] = make_pair(pos, RankStatus::NameMatch);
|
||||
else if (ores->second.second == RankStatus::NameMatch)
|
||||
output[r->getId()] = make_pair(pos, RankStatus::Ambivalent); // Not clear. Do not match.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* oDataInterface DI=r->getDI();
|
||||
|
||||
if (rank)
|
||||
DI.setInt("Rank", rank.getObjectInt("RankPosition"));
|
||||
|
||||
// if (vrank)
|
||||
// DI.setInt("VacRank", vrank.getObjectInt("RankPosition"));
|
||||
|
||||
r->synchronize();
|
||||
r->synchronize();*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -4516,9 +4516,9 @@ bool oRunner::matchName(const wstring &pname) const
|
||||
nMatched++;
|
||||
|
||||
// Suppert changed last name in the most common case
|
||||
if (j == 0 && k == 0 && inNames.size() == 2 && myNames.size() == 2) {
|
||||
/*if (j == 0 && k == 0 && inNames.size() == 2 && myNames.size() == 2) {
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -533,6 +533,7 @@ void RestServer::getData(oEvent &oe, const string &what, const multimap<string,
|
||||
throw meosException("Invalid limit: " + param.find("limit")->second);
|
||||
}
|
||||
|
||||
bool inclRunnersInForest = param.count("allrunners")>0;
|
||||
if (param.count("type")) {
|
||||
string type = param.find("type")->second;
|
||||
|
||||
@ -645,7 +646,8 @@ void RestServer::getData(oEvent &oe, const string &what, const multimap<string,
|
||||
r.swap(r2);
|
||||
}
|
||||
|
||||
GeneralResult::calculateIndividualResults(r, controlId, totalResult, resTag, resType, inputNumber, oe, results);
|
||||
GeneralResult::calculateIndividualResults(r, controlId, totalResult, inclRunnersInForest, resTag, resType, inputNumber, oe, results);
|
||||
|
||||
|
||||
if (resType == oListInfo::Classwise)
|
||||
sort(results.begin(), results.end());
|
||||
@ -758,6 +760,20 @@ void RestServer::getData(oEvent &oe, const string &what, const multimap<string,
|
||||
|
||||
}
|
||||
}
|
||||
else if (what == "status") {
|
||||
InfoMeosStatus iStatus;
|
||||
if (oe.empty()) {
|
||||
iStatus.setEventNameId(L""); // no event
|
||||
iStatus.setOnDatabase(false);
|
||||
}
|
||||
else {
|
||||
iStatus.setEventNameId(oe.getNameId(0)); // id of event
|
||||
iStatus.setOnDatabase(oe.isClient()); // onDatabase
|
||||
}
|
||||
|
||||
iStatus.serialize(out, false);
|
||||
okRequest = true;
|
||||
}
|
||||
if (out.size() > 0) {
|
||||
xmlparser mem;
|
||||
mem.openMemoryOutput(false);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user