You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by re...@apache.org on 2015/12/13 21:08:24 UTC
[1/2] git commit: updated refs/heads/master to 7c83e1b
Repository: cloudstack
Updated Branches:
refs/heads/master c1533a191 -> 7c83e1b24
QUOTA: Ensuring that the dates displayed are as per user expectations
When querying db we use start of next day to query quota usage for
today, but while displaying it to user we still need to show it as
todays date
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1e17c3e3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1e17c3e3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1e17c3e3
Branch: refs/heads/master
Commit: 1e17c3e38cf70d965d0fc84cbf67f78ef5203e71
Parents: 312b9af
Author: Abhinandan Prateek <ab...@shapeblue.com>
Authored: Tue Dec 8 09:59:06 2015 +0530
Committer: Abhinandan Prateek <ab...@shapeblue.com>
Committed: Fri Dec 11 14:53:51 2015 +0530
----------------------------------------------------------------------
.../apache/cloudstack/api/command/QuotaBalanceCmd.java | 11 ++++++++---
.../api/response/QuotaResponseBuilderImpl.java | 6 +++---
.../org/apache/cloudstack/quota/QuotaServiceImpl.java | 10 +++++-----
3 files changed, 16 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1e17c3e3/plugins/database/quota/src/org/apache/cloudstack/api/command/QuotaBalanceCmd.java
----------------------------------------------------------------------
diff --git a/plugins/database/quota/src/org/apache/cloudstack/api/command/QuotaBalanceCmd.java b/plugins/database/quota/src/org/apache/cloudstack/api/command/QuotaBalanceCmd.java
index 32bbfc8..8efa678 100644
--- a/plugins/database/quota/src/org/apache/cloudstack/api/command/QuotaBalanceCmd.java
+++ b/plugins/database/quota/src/org/apache/cloudstack/api/command/QuotaBalanceCmd.java
@@ -83,7 +83,12 @@ public class QuotaBalanceCmd extends BaseCmd {
}
public Date getEndDate() {
- return endDate == null ? null : _responseBuilder.startOfNextDay(endDate == null ? null : new Date(endDate.getTime()));
+ if (endDate == null){
+ return null;
+ }
+ else{
+ return _responseBuilder.startOfNextDay(new Date(endDate.getTime()));
+ }
}
public void setEndDate(Date endDate) {
@@ -113,10 +118,10 @@ public class QuotaBalanceCmd extends BaseCmd {
List<QuotaBalanceVO> quotaUsage = _responseBuilder.getQuotaBalance(this);
QuotaBalanceResponse response;
- if (getEndDate() == null) {
+ if (endDate == null) {
response = _responseBuilder.createQuotaLastBalanceResponse(quotaUsage, getStartDate());
} else {
- response = _responseBuilder.createQuotaBalanceResponse(quotaUsage, getStartDate(), endDate == null ? null : new Date(endDate.getTime()));
+ response = _responseBuilder.createQuotaBalanceResponse(quotaUsage, getStartDate(), new Date(endDate.getTime()));
}
response.setResponseName(getCommandName());
setResponseObject(response);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1e17c3e3/plugins/database/quota/src/org/apache/cloudstack/api/response/QuotaResponseBuilderImpl.java
----------------------------------------------------------------------
diff --git a/plugins/database/quota/src/org/apache/cloudstack/api/response/QuotaResponseBuilderImpl.java b/plugins/database/quota/src/org/apache/cloudstack/api/response/QuotaResponseBuilderImpl.java
index 23b1363..4a2816d 100644
--- a/plugins/database/quota/src/org/apache/cloudstack/api/response/QuotaResponseBuilderImpl.java
+++ b/plugins/database/quota/src/org/apache/cloudstack/api/response/QuotaResponseBuilderImpl.java
@@ -233,9 +233,9 @@ public class QuotaResponseBuilderImpl implements QuotaResponseBuilder {
// order is desc last item is the start item
QuotaBalanceVO startItem = quotaBalance.get(quotaBalance.size() - 1);
QuotaBalanceVO endItem = quotaBalance.get(0);
- resp.setStartDate(startItem.getUpdatedOn());
+ resp.setStartDate(startDate);
resp.setStartQuota(startItem.getCreditBalance());
- resp.setEndDate(endItem.getUpdatedOn());
+ resp.setEndDate(endDate);
if (s_logger.isDebugEnabled()) {
s_logger.debug("createQuotaBalanceResponse: Start Entry=" + startItem);
s_logger.debug("createQuotaBalanceResponse: End Entry=" + endItem);
@@ -479,7 +479,7 @@ public class QuotaResponseBuilderImpl implements QuotaResponseBuilder {
lastCredits = lastCredits.add(entry.getCreditBalance());
}
resp.setStartQuota(lastCredits);
- resp.setStartDate(_quotaService.computeAdjustedTime(startDate));
+ resp.setStartDate(startDate);
resp.setCurrency(QuotaConfig.QuotaCurrencySymbol.value());
resp.setObjectName("balance");
return resp;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1e17c3e3/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaServiceImpl.java
----------------------------------------------------------------------
diff --git a/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaServiceImpl.java b/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaServiceImpl.java
index 9894f11..355982b 100644
--- a/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaServiceImpl.java
+++ b/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaServiceImpl.java
@@ -138,8 +138,8 @@ public class QuotaServiceImpl extends ManagerBase implements QuotaService, Confi
@Override
public ConfigKey<?>[] getConfigKeys() {
- return new ConfigKey<?>[] { QuotaPluginEnabled, QuotaEnableEnforcement, QuotaCurrencySymbol, QuotaStatementPeriod, QuotaSmtpHost, QuotaSmtpPort, QuotaSmtpTimeout, QuotaSmtpUser, QuotaSmtpPassword,
- QuotaSmtpAuthType, QuotaSmtpSender };
+ return new ConfigKey<?>[] {QuotaPluginEnabled, QuotaEnableEnforcement, QuotaCurrencySymbol, QuotaStatementPeriod, QuotaSmtpHost, QuotaSmtpPort, QuotaSmtpTimeout,
+ QuotaSmtpUser, QuotaSmtpPassword, QuotaSmtpAuthType, QuotaSmtpSender};
}
@Override
@@ -193,8 +193,8 @@ public class QuotaServiceImpl extends ManagerBase implements QuotaService, Confi
} else if (startDate.before(endDate)) {
Date adjustedEndDate = computeAdjustedTime(endDate);
if (s_logger.isDebugEnabled()) {
- s_logger.debug("getQuotaBalance2: Getting quota balance records for account: " + accountId + ", domainId: " + domainId + ", between " + adjustedStartDate + " and "
- + adjustedEndDate);
+ s_logger.debug("getQuotaBalance2: Getting quota balance records for account: " + accountId + ", domainId: " + domainId + ", between " + adjustedStartDate
+ + " and " + adjustedEndDate);
}
List<QuotaBalanceVO> qbrecords = _quotaBalanceDao.findQuotaBalance(accountId, domainId, adjustedStartDate, adjustedEndDate);
if (s_logger.isDebugEnabled()) {
@@ -243,7 +243,7 @@ public class QuotaServiceImpl extends ManagerBase implements QuotaService, Confi
Date adjustedEndDate = computeAdjustedTime(endDate);
Date adjustedStartDate = computeAdjustedTime(startDate);
if (s_logger.isDebugEnabled()) {
- s_logger.debug("Getting quota records for account: " + accountId + ", domainId: " + domainId + ", between " + startDate + " and " + endDate);
+ s_logger.debug("Getting quota records for account: " + accountId + ", domainId: " + domainId + ", between " + adjustedStartDate + " and " + adjustedEndDate);
}
return _quotaUsageDao.findQuotaUsage(accountId, domainId, usageType, adjustedStartDate, adjustedEndDate);
}
[2/2] git commit: updated refs/heads/master to 7c83e1b
Posted by re...@apache.org.
Merge pull request #1205 from shapeblue/master-9126
QUOTA: Ensuring that the dates displayed are as per user expectations When querying db we use start of next day to query quota usage for
today, but while displaying it to user we still need to show it as
todays date
* pr/1205:
QUOTA: Ensuring that the dates displayed are as per user expectations
Signed-off-by: Remi Bergsma <gi...@remi.nl>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7c83e1b2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7c83e1b2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7c83e1b2
Branch: refs/heads/master
Commit: 7c83e1b2402db9e359fb086b158d65c25309a70e
Parents: c1533a1 1e17c3e
Author: Remi Bergsma <gi...@remi.nl>
Authored: Sun Dec 13 21:08:10 2015 +0100
Committer: Remi Bergsma <gi...@remi.nl>
Committed: Sun Dec 13 21:08:10 2015 +0100
----------------------------------------------------------------------
.../apache/cloudstack/api/command/QuotaBalanceCmd.java | 11 ++++++++---
.../api/response/QuotaResponseBuilderImpl.java | 6 +++---
.../org/apache/cloudstack/quota/QuotaServiceImpl.java | 2 +-
3 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c83e1b2/plugins/database/quota/src/org/apache/cloudstack/api/response/QuotaResponseBuilderImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c83e1b2/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaServiceImpl.java
----------------------------------------------------------------------