]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
xmlrpc: fix max_count for check_list
authorDaniel Axtens <dja@axtens.net>
Sat, 3 Sep 2016 07:07:15 +0000 (17:07 +1000)
committerStephen Finucane <stephenfinucane@hotmail.com>
Sat, 3 Sep 2016 22:25:42 +0000 (23:25 +0100)
Negative values were broken due to some missing code. Fix it by adding
code based on an example from one of the other models.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
patchwork/views/xmlrpc.py

index 890db75c0a1360121fc889b33bd4aa6cf671329f..e47019c8b37c2f4982cbcc65f5f6c8e1315a0c13 100644 (file)
@@ -933,6 +933,9 @@ def check_list(filt=None):
 
         if max_count > 0:
             return list(map(check_to_dict, checks[:max_count]))
+        elif max_count < 0:
+            min_count = checks.count() + max_count
+            return list(map(check_to_dict, checks[min_count:]))
         else:
             return list(map(check_to_dict, checks))
     except Check.DoesNotExist: