1#include "userstatistics.h"
3UserStatistics::UserStatistics() =
default;
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) {
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();
16 if (json.contains(TOTAL_GAMES_PLAYED) &&
17 json[TOTAL_GAMES_PLAYED].isDouble()) {
18 total_games_played = json[TOTAL_GAMES_PLAYED].toInt();
22void UserStatistics::write(QJsonObject &json) {