couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From garrensmith <...@git.apache.org>
Subject [GitHub] couchdb pull request: Group log messages by date - COUCHDB-2136
Date Mon, 21 Apr 2014 15:21:44 GMT
Github user garrensmith commented on a diff in the pull request:

    https://github.com/apache/couchdb/pull/214#discussion_r11811097
  
    --- Diff: src/fauxton/app/addons/logs/resources.js ---
    @@ -110,7 +119,28 @@ function (app, FauxtonAPI, Backbone, d3) {
         },
     
         serialize: function () {
    -      return { logs: new Log.Collection(this.createFilteredCollection())};
    +      var collection = new Log.Collection(this.createFilteredCollection());
    +
    +      return {
    +        days: this.sortLogsIntoDays(collection)
    +      };
    +    },
    +
    +    sortLogsIntoDays: function (collection) {
    +      var sortedCollection = {},
    +          date = null;
    +
    +      collection.each(function (log) {
    --- End diff --
    
    You can use `_.reduce` instead of `.each` it will make it much neater and require less
variables. We use _.reduce in a couple places, so you can grep for some examples.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message