Display used storage space in UI
This commit is contained in:
11
src/main.cpp
11
src/main.cpp
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user