1#include "usergamestatistics.h"
4UserGameStatistics::UserGameStatistics() =
default;
6UserGameStatistics::UserGameStatistics(QString _game_id,
10 : game_id(std::move(_game_id)),
11 time_played_sec(_time_played_sec),
12 games_played(_games_played),
16void UserGameStatistics::read(
const QJsonObject &json) {
17 if (json.contains(GAME_ID) && json[GAME_ID].isString()) {
18 game_id = json[GAME_ID].toString();
20 if (json.contains(TIME_PLAYED_SEC) && json[TIME_PLAYED_SEC].isDouble()) {
21 time_played_sec = json[TIME_PLAYED_SEC].toInt();
23 if (json.contains(GAMES_PLAYED) && json[GAMES_PLAYED].isDouble()) {
24 games_played = json[GAMES_PLAYED].toInt();
26 if (json.contains(WIN_RATE) && json[WIN_RATE].isDouble()) {
27 win_rate = json[WIN_RATE].toDouble();
31void UserGameStatistics::write(QJsonObject &json) {