app/sources/competition/result/brresult.cpp
Dorian Zedler 85c8760bed
- moved some stuff
- results work now (still basic)
2020-11-15 14:48:12 +01:00

56 lines
1.2 KiB
C++

#include "brresult.h"
#include "brround.h"
#include "brcategory.h"
BRResult::BRResult(BRResultData initialData) : BRWidget(nullptr, BRWidget::UnknownFederation, -1)
{
this->round = nullptr;
this->setData(initialData);
}
int BRResult::getRank() const {
return this->rank;
}
int BRResult::getStartNumber() const {
return this->startNumber;
}
BRAthlete* BRResult::getAthlete() const {
return this->athlete;
}
BRResultDetails* BRResult::getDetails() const {
return this->details;
}
BRRound* BRResult::getRound() const {
return this->round;
}
void BRResult::setData(BRResultData data) {
this->rank = data.rank;
this->startNumber = data.startNumber;
this->details = data.details;
if(data.details != nullptr)
this->details->result = this;
this->athlete = data.athlete;
emit this->metadataChanged();
}
BRWidget::BRWidgetStatusCode BRResult::load() {
return BRWidget::OpeationNotSupportedError;
}
bool BRResult::lessThan(BRResult* result1, BRResult* result2) {
if(result1->getAthlete()->getId() == result2->getAthlete()->getId())
return BRRound::lessThan(result1->getRound(), result2->getRound());
else
return result1->getRank() < result2->getRank();
}