diff --git a/server/mergin/stats/tasks.py b/server/mergin/stats/tasks.py index 4770a90e..345d68cd 100644 --- a/server/mergin/stats/tasks.py +++ b/server/mergin/stats/tasks.py @@ -64,6 +64,7 @@ def send_statistics(): "workspaces_count": current_app.ws_handler.workspace_count(), "last_change": str(last_change_item.updated) + "Z" if last_change_item else "", "server_version": current_app.config["VERSION"], + "monthly_contributors": current_app.ws_handler.monthly_contributors_count(), } try: diff --git a/server/mergin/sync/interfaces.py b/server/mergin/sync/interfaces.py index 8084b091..4cf12650 100644 --- a/server/mergin/sync/interfaces.py +++ b/server/mergin/sync/interfaces.py @@ -154,6 +154,13 @@ def workspace_count(): """ pass + @staticmethod + def monthly_contributors_count(): + """ + Return number of workspace contributors in current month and year + """ + pass + class AbstractProjectHandler(ABC): @abstractmethod diff --git a/server/mergin/sync/workspace.py b/server/mergin/sync/workspace.py index 86360fef..18dcd8f2 100644 --- a/server/mergin/sync/workspace.py +++ b/server/mergin/sync/workspace.py @@ -248,6 +248,10 @@ def filter_projects( def workspace_count(): return 1 + @staticmethod + def monthly_contributors_count(): + return 0 + def projects_query(self, name=None, workspace=None): ws = self.factory_method() query = db.session.query( diff --git a/server/mergin/tests/test_statistics.py b/server/mergin/tests/test_statistics.py index b952039b..053a3695 100644 --- a/server/mergin/tests/test_statistics.py +++ b/server/mergin/tests/test_statistics.py @@ -46,10 +46,12 @@ def test_send_statistics(app, caplog): "workspaces_count", "last_change", "server_version", + "monthly_contributors", } assert data["workspaces_count"] == 1 assert data["service_uuid"] == app.config["SERVICE_ID"] assert data["licence"] == "ce" + assert data["monthly_contributors"] == 0 # repeated action does not do anything task = send_statistics.s().apply()