diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2016-09-27 01:16:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-27 01:16:11 +0300 |
commit | f0f613042d36be5b963159446c4560fe37272c36 (patch) | |
tree | fd5b7a84ccd0ddbd9d2d41fa02ea42578604e1c7 | |
parent | 71e5df88bb52931f0e9fd0db4696576b629a8d60 (diff) | |
parent | 815c594d3846d4636e8741bd7e45c0013a1b51d8 (diff) |
Merge pull request #8 from nextcloud/small-improvements
Small improvements
-rw-r--r-- | js/script.js | 12 | ||||
-rw-r--r-- | lib/BackgroundJobs/ComputeStatistics.php | 4 |
2 files changed, 11 insertions, 5 deletions
diff --git a/js/script.js b/js/script.js index 02f6e04..026cc8f 100644 --- a/js/script.js +++ b/js/script.js @@ -57,9 +57,15 @@ * @param users statistics about the users */ var ocNumericStatistics = function(id, data) { - $('#' + id + 'Max span').text(data['max']); - $('#' + id + 'Min span').text(data['min']); - $('#' + id + 'Average span').text(data['average']); + if (id.substring(0, 3) == 'php' || id.substring(0, 8) == 'database') { + $('#' + id + 'Max span').text(OC.Util.humanFileSize(data['max'])); + $('#' + id + 'Min span').text(OC.Util.humanFileSize(data['min'])); + $('#' + id + 'Average span').text(OC.Util.humanFileSize(data['average'])); + } else { + $('#' + id + 'Max span').text(data['max']); + $('#' + id + 'Min span').text(data['min']); + $('#' + id + 'Average span').text(data['average']); + } }; /** diff --git a/lib/BackgroundJobs/ComputeStatistics.php b/lib/BackgroundJobs/ComputeStatistics.php index 44ca2e9..6ec38a8 100644 --- a/lib/BackgroundJobs/ComputeStatistics.php +++ b/lib/BackgroundJobs/ComputeStatistics.php @@ -136,7 +136,7 @@ class ComputeStatistics extends TimedJob { $query = $this->connection->getQueryBuilder(); $result = $query - ->select($query->createFunction('AVG(`value`) AS average, MAX(`value`) as max, MIN(`value`) as min')) + ->select($query->createFunction('AVG(CAST(`value` AS SIGNED)) AS average, MAX(CAST(`value` AS SIGNED)) as max, MIN(CAST(`value` AS SIGNED)) as min')) ->from($this->table) ->where($query->expr()->eq('key', $query->createNamedParameter($key))) ->andWhere($query->expr()->eq('category', $query->createNamedParameter($category))) @@ -194,7 +194,7 @@ class ComputeStatistics extends TimedJob { } } - $max = $statistics['files']; + $max = $statistics['survey_client']; foreach ($statistics as $key => $value) { $statistics[$key] = 100/$max*$value; |