From 2ca35712f375091f91892304e6a8cd33f7e1f263 Mon Sep 17 00:00:00 2001 From: Scott Noyes Date: Thu, 7 May 2020 20:49:48 -0500 Subject: [PATCH] collection stats - whole collection (#169) * Add endpoint to retrieve collection stats report * Create separate test for statistics * Add test for collectionStats * Fixed typo * Change endpoint name to use a verb * Change name to getCollectionStatsHTML * Allow stats for whole collection * Allow stats for whole collection --- README.md | 5 ++++- plugin/__init__.py | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dc0c144..d0de165 100644 --- a/README.md +++ b/README.md @@ -377,7 +377,10 @@ guarantee that your application continues to function properly in the future. ```json { "action": "getCollectionStatsHTML", - "version": 6 + "version": 6, + "params": { + "wholeCollection": true + } } ``` diff --git a/plugin/__init__.py b/plugin/__init__.py index 9e1b91e..fa3cccf 100644 --- a/plugin/__init__.py +++ b/plugin/__init__.py @@ -299,8 +299,10 @@ class AnkiConnect: @util.api() - def getCollectionStatsHTML(self): - return self.collection().stats().report() + def getCollectionStatsHTML(self, wholeCollection=True): + stats = self.collection().stats() + stats.wholeCollection = wholeCollection + return stats.report() #