Display used storage space in UI

This commit is contained in:
Tina_Azure
2023-08-02 18:16:22 +02:00
parent f2bbadcf70
commit 008b6edce1
5 changed files with 24 additions and 5 deletions

View File

@ -983,9 +983,16 @@ int main(int argc, char *argv[]) {
if (Utilities::checkCookieLoginState(configuration, cookieCtx)) {
ctx[MUSTACHE_COOKIE_LOGGED_IN] = true;
size_t usedStorageInMB = 0; //todo:database operation
pqxx::connection databaseConnection(configuration.databaseConnectionString);
Database::prepareStatements(databaseConnection, {
ID_SELECT_FREELANCER_FILE_SUBMISSION_USED_STORAGE
});
pqxx::result freelancerUsedStorageResult = Database::executePreparedStatement_SELECT_FREELANCER_FILE_SUBMISSION_USED_STORAGE(databaseConnection, cookieCtx.get_cookie(COOKIE_FREELANCER_EMAIL));
double usedStorageInMB = stod(freelancerUsedStorageResult.at(0).at(0).c_str());
size_t maxStorageInMB = configuration.submissionMaxtotalStorageMB;
ctx[MUSTACHE_FREELANCER_AVAILIBLE_STORAGE_IN_MB] = usedStorageInMB;
ctx[MUSTACHE_FREELANCER_USED_STORAGE_IN_MB] = usedStorageInMB;
ctx[MUSTACHE_FREELANCER_MAXIMUM_STORAGE_IN_MB] = maxStorageInMB;
ctx[MUSTACHE_FREELANCER_MAXIMUM_FILE_NAME_SIZE] = configuration.submissionMaxFileNameSize;