Cavoke  1.1.0
A Platform for creating and hosting multiplayer turn-based board games
Loading...
Searching...
No Matches
userstatistics.cpp
1#include "userstatistics.h"
2
3UserStatistics::UserStatistics() = default;
4
5UserStatistics::UserStatistics(int _total_time_played_sec,
6 int _total_games_played)
7 : total_time_played_sec(_total_time_played_sec),
8 total_games_played(_total_games_played) {
9}
10
11void UserStatistics::read(const QJsonObject &json) {
12 if (json.contains(TOTAL_TIME_PLAYED_SEC) &&
13 json[TOTAL_TIME_PLAYED_SEC].isDouble()) {
14 total_time_played_sec = json[TOTAL_TIME_PLAYED_SEC].toInt();
15 }
16 if (json.contains(TOTAL_GAMES_PLAYED) &&
17 json[TOTAL_GAMES_PLAYED].isDouble()) {
18 total_games_played = json[TOTAL_GAMES_PLAYED].toInt();
19 }
20}
21
22void UserStatistics::write(QJsonObject &json) {
23 assert(false); // Should not be used
24}