#112 Update comments: Ignore the ones made by Bodhi
Merged 4 years ago by frantisekz. Opened 4 years ago by frantisekz.

file modified
+1 -2
@@ -60,7 +60,6 @@ 

  

      return updates

  

- 

  def process_update(update):

      """

      Cleans up single update dictionary to contain only data frontend needs
@@ -77,7 +76,7 @@ 

          "url": update["url"],

          "status": "%s→%s" % (update["status"], update["request"]) if update["request"] else update["status"],

          "karma": update["karma"],

-         "comments": len(update["comments"])

+         "comments": len([c for c in update["comments"] if c["user"]["name"] != "bodhi"])

      }

  

  

@@ -59,8 +59,16 @@ 

          ],

          "close_bugs": True,

          "comments": [

-             {},

-             {}

+             {

+                 "user": {

+                     "name": "bodhi"

+                 }

+             },

+             {

+                 "user": {

+                     "name": "somebody"

+                 }

+             }

          ],

          "compose": None,

          "content_type": "rpm",
@@ -193,7 +201,7 @@ 

          expected_result_single_package = {

              'gjs': [

                  {

-                     'comments': 2,

+                     'comments': 1,

                      'karma': 2,

                      'pretty_name': 'gjs-1.66.1-2.fc98',

                      'release': 'Fedora 98',
@@ -210,7 +218,7 @@ 

          expected_result_multiple_packages = {

              'gjs': [

                  {

-                     'comments': 2,

+                     'comments': 1,

                      'karma': 2,

                      'pretty_name': 'gjs-1.66.1-2.fc98 mozjs78-78.4.0-1.fc98',

                      'release': 'Fedora 98',
@@ -223,7 +231,7 @@ 

              ],

              'mozjs78': [

                  {

-                     'comments': 2,

+                     'comments': 1,

                      'karma': 2,

                      'pretty_name': 'gjs-1.66.1-2.fc98 mozjs78-78.4.0-1.fc98',

                      'release': 'Fedora 98',

Build succeeded.

The same, but in one line:

return len([c for comments if c['user']['name'] != 'bodhi'])

Anyway, LGTM, do what you will with the comment above

rebased onto 731bc98

4 years ago

Build succeeded.

Pull-Request has been merged by frantisekz

4 years ago