change redirect after checkTransaction, update format of balance

This commit is contained in:
Dario 2019-12-19 13:19:59 +01:00
parent 987c820a5b
commit 2c5a20e9db
4 changed files with 14 additions and 6 deletions

View File

@ -69,7 +69,7 @@ void CheckTransactionPage::handleRequest(Poco::Net::HTTPServerRequest& request,
size_t notReadyTransactions = 0; size_t notReadyTransactions = 0;
size_t sumTransactions = mSession->getProcessingTransactionCount(); size_t sumTransactions = mSession->getProcessingTransactionCount();
if(sumTransactions == 0) { if(sumTransactions == 0) {
response.redirect(ServerConfig::g_php_serverPath); response.redirect(ServerConfig::g_php_serverPath + "state-balances/overview");
return; return;
} }
auto processingTransaction = mSession->getNextReadyTransaction(&notReadyTransactions); auto processingTransaction = mSession->getNextReadyTransaction(&notReadyTransactions);
@ -175,10 +175,10 @@ void CheckTransactionPage::handleRequest(Poco::Net::HTTPServerRequest& request,
#line 60 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\header_navi.cpsp" #line 60 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\header_navi.cpsp"
responseStream << ( ServerConfig::g_php_serverPath ); responseStream << ( ServerConfig::g_php_serverPath );
responseStream << "state-balances/overview\" title=\"Kontoübersicht\">\n"; responseStream << "state-balances/overview\" title=\"Kontoübersicht\">\n";
responseStream << " <span class=\"link-title\">"; responseStream << " <span class=\"link-title\">Kontoübersicht (";
#line 61 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\header_navi.cpsp" #line 61 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\header_navi.cpsp"
responseStream << ( TransactionBase::amountToString(userBalance) ); responseStream << ( TransactionBase::amountToString(userBalance) );
responseStream << " GDD</span>\n"; responseStream << " GDD)</span>\n";
responseStream << " <i class=\"mdi mdi-wallet-outline link-icon\"></i>\n"; responseStream << " <i class=\"mdi mdi-wallet-outline link-icon\"></i>\n";
responseStream << " </a>\n"; responseStream << " </a>\n";
responseStream << " </li>\n"; responseStream << " </li>\n";

View File

@ -13,5 +13,13 @@ std::string TransactionBase::amountToString(google::protobuf::int64 amount)
std::stringstream ss; std::stringstream ss;
double dAmount = amount / 10000.0; double dAmount = amount / 10000.0;
ss << std::fixed << std::setprecision(2) << dAmount; ss << std::fixed << std::setprecision(2) << dAmount;
return ss.str(); std::string amountString = ss.str();
if (amountString.find('.') != amountString.npos) {
int pointPlace = amountString.find('.');
if (amountString.substr(pointPlace+1) == "00") {
amountString = amountString.substr(0, pointPlace);
}
}
return amountString;
//return ss.str();
} }

View File

@ -47,7 +47,7 @@ enum PageState {
size_t notReadyTransactions = 0; size_t notReadyTransactions = 0;
size_t sumTransactions = mSession->getProcessingTransactionCount(); size_t sumTransactions = mSession->getProcessingTransactionCount();
if(sumTransactions == 0) { if(sumTransactions == 0) {
response.redirect(ServerConfig::g_php_serverPath); response.redirect(ServerConfig::g_php_serverPath + "state-balances/overview");
return; return;
} }
auto processingTransaction = mSession->getNextReadyTransaction(&notReadyTransactions); auto processingTransaction = mSession->getNextReadyTransaction(&notReadyTransactions);

View File

@ -58,7 +58,7 @@
<ul class="navigation-menu"> <ul class="navigation-menu">
<li> <li>
<a href="<%= ServerConfig::g_php_serverPath %>state-balances/overview" title="Kontoübersicht"> <a href="<%= ServerConfig::g_php_serverPath %>state-balances/overview" title="Kontoübersicht">
<span class="link-title"><%= TransactionBase::amountToString(userBalance) %> GDD</span> <span class="link-title">Kontoübersicht (<%= TransactionBase::amountToString(userBalance) %> GDD)</span>
<i class="mdi mdi-wallet-outline link-icon"></i> <i class="mdi mdi-wallet-outline link-icon"></i>
</a> </a>
</li> </li>