summaryrefslogtreecommitdiff
path: root/src/model/MedalWinner.cpp
blob: c4cb6631b031b334974da34b987247f63d3e6572 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

#include "MedalWinner.h"

bool MedalWinner::setMedals(const QJsonObject &medals) {
    if (!medals.contains("ME_GOLD")
        || !medals.contains("ME_SILVER")
        || !medals.contains("ME_BRONZE")) {
        throw invalid_argument("Medal object of competitor is incomplete.");
    }

    this->wonMedals = {
            {QString("ME_GOLD"), medals["ME_GOLD"].toString()},
            {QString("ME_SILVER"), medals["ME_SILVER"].toString()},
            {QString("ME_BRONZE"), medals["ME_BRONZE"].toString()}
    };

    return true;
}