implemented genus test results

This commit is contained in:
Michael Mandl 2018-06-15 17:53:43 +02:00
parent 060348fdc5
commit 5bc7edabc6
11 changed files with 129 additions and 61 deletions

View file

@ -178,3 +178,21 @@ const CheckableItem &CheckableTestModel::getItem(const QModelIndex &index) const
throw std::runtime_error("invalid index");
}
unsigned int CheckableTestModel::getPoints() const
{
size_t points = 0;
for (const auto &test : m_tests)
{
for (const auto &item : test.items())
{
if (item.isChecked())
{
points++;
}
}
}
return points;
}

View file

@ -28,6 +28,8 @@ public:
void write(QJsonObject &json) const;
void read(const QJsonObject &json);
unsigned int getPoints() const;
private:
bool isValidIndex(const QModelIndex &index) const;