1.4.10 updates
This commit is contained in:
@@ -4,8 +4,10 @@
|
||||
|
||||
#include <sql/SqlQuery.h>
|
||||
#include <misc/std_unique_ptr.h>
|
||||
|
||||
#include <utility>
|
||||
#include "StatisticManager.h"
|
||||
#include "LicenseManager.h"
|
||||
#include "DatabaseHandler.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace std::chrono;
|
||||
@@ -76,16 +78,16 @@ system_clock::time_point HistoryStatistics::align_type(license::stats::HistorySt
|
||||
}
|
||||
}
|
||||
|
||||
StatisticManager::StatisticManager(const std::shared_ptr<license::server::LicenseManager> &manager) : license_manager(manager) {}
|
||||
StatisticManager::~StatisticManager() {}
|
||||
StatisticManager::StatisticManager(std::shared_ptr<license::server::database::DatabaseHandler> manager) : license_manager{std::move(manager)} {}
|
||||
StatisticManager::~StatisticManager() = default;
|
||||
|
||||
struct GeneralStatisticEntry {
|
||||
std::chrono::system_clock::time_point age;
|
||||
string unique_id = "";
|
||||
uint64_t key_id = 0;
|
||||
uint64_t servers = 0;
|
||||
uint64_t clients = 0;
|
||||
uint64_t bots = 0;
|
||||
string unique_id{""};
|
||||
uint64_t key_id{0};
|
||||
uint64_t servers{0};
|
||||
uint64_t clients{0};
|
||||
uint64_t bots{0};
|
||||
};
|
||||
|
||||
void StatisticManager::reset_cache_general() {
|
||||
@@ -93,7 +95,7 @@ void StatisticManager::reset_cache_general() {
|
||||
this->_general_statistics = nullptr;
|
||||
}
|
||||
|
||||
void parse_general_entry(deque<unique_ptr<GeneralStatisticEntry>>& entries, bool unique, int length, string* values, string* names) {
|
||||
void parse_general_entry(std::deque<std::unique_ptr<GeneralStatisticEntry>>& entries, bool unique, int length, string* values, string* names) {
|
||||
auto entry = make_unique<GeneralStatisticEntry>();
|
||||
for(int index = 0; index < length; index++) {
|
||||
if(names[index] == "keyId") {
|
||||
@@ -139,7 +141,7 @@ std::shared_ptr<GeneralStatistics> StatisticManager::general_statistics() {
|
||||
|
||||
auto result = sql::command(this->license_manager->sql(), "SELECT `keyId`, `unique_id`, `timestamp`,`server`,`clients`,`music` FROM `history_online` WHERE `timestamp` > :time ORDER BY `timestamp` ASC",
|
||||
variable{":time", duration_cast<milliseconds>(system_clock::now().time_since_epoch() - hours(2) - minutes(10)).count()}) //10min as buffer
|
||||
.query(std::function<decltype(parse_general_entry)>(parse_general_entry), entries, true);
|
||||
.query(std::function<decltype(parse_general_entry)>{parse_general_entry}, entries, true);
|
||||
|
||||
auto stats = make_shared<GeneralStatistics>();
|
||||
for(auto& entry : entries) {
|
||||
|
||||
Reference in New Issue
Block a user