You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by wi...@apache.org on 2019/10/28 12:15:00 UTC

[couchdb-fauxton] branch query_stats_formatting created (now 6bd4a77)

This is an automated email from the ASF dual-hosted git repository.

willholley pushed a change to branch query_stats_formatting
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git.


      at 6bd4a77  Improve execution stats formatting

This branch includes the following new commits:

     new 6bd4a77  Improve execution stats formatting

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb-fauxton] 01/01: Improve execution stats formatting

Posted by wi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

willholley pushed a commit to branch query_stats_formatting
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git

commit 6bd4a77f54820dab79f6cb0393717d33f6a0761e
Author: Will Holley <wi...@gmail.com>
AuthorDate: Mon Oct 28 12:13:10 2019 +0000

    Improve execution stats formatting
    
    As observed in https://github.com/apache/couchdb/issues/2236#issuecomment-546884302,
    minute/second values were not rounded correctly.
    
    This PR floors the minute/second values and handles the case where
    minute/second == 1.
---
 app/addons/documents/mango/components/ExecutionStats.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/app/addons/documents/mango/components/ExecutionStats.js b/app/addons/documents/mango/components/ExecutionStats.js
index 01f5d27..789a886 100644
--- a/app/addons/documents/mango/components/ExecutionStats.js
+++ b/app/addons/documents/mango/components/ExecutionStats.js
@@ -29,9 +29,12 @@ export default class ExecutionStats extends React.Component {
       return Math.floor(seconds) + ' seconds';
     }
     const minutes = Math.floor(seconds / 60);
-    seconds = seconds - (minutes * 60);
+    seconds = Math.floor(seconds - (minutes * 60));
 
-    return minutes + 'minute, ' + seconds + 'seconds';
+    const minuteText = minutes > 1 ? 'minutes' : 'minute';
+    const secondsText = seconds > 1 ? 'seconds' : 'second';
+
+    return [minutes, ' ', minuteText, ', ', seconds, ' ', secondsText].join('');
   }
 
   getWarning(executionStats, warning) {
@@ -70,7 +73,7 @@ export default class ExecutionStats extends React.Component {
         {this.executionStatsLine("documents examined", executionStats.total_docs_examined)}
         {this.executionStatsLine("documents examined (quorum)", executionStats.total_quorum_docs_examined)}
         {this.executionStatsLine("results returned", executionStats.results_returned, true)}
-        {this.executionStatsLine("execution time", executionStats.execution_time_ms, false, "ms")}
+        {this.executionStatsLine("execution time", Math.round(executionStats.execution_time_ms), false, "ms")}
       </div>
     );
   }