[Debtags-commits] [svn] r1994 - central-database/trunk/c-tdb
Erich Schubert
erich at costa.debian.org
Wed Oct 4 22:55:25 UTC 2006
Author: erich
Date: Wed Oct 4 22:55:24 2006
New Revision: 1994
Modified:
central-database/trunk/c-tdb/tagcloud-json.cc
Log:
add some statistics
Modified: central-database/trunk/c-tdb/tagcloud-json.cc
==============================================================================
--- central-database/trunk/c-tdb/tagcloud-json.cc (original)
+++ central-database/trunk/c-tdb/tagcloud-json.cc Wed Oct 4 22:55:24 2006
@@ -37,6 +37,8 @@
set<dbid> sel_tags;
set<dbid> remaining_pkgs;
+ int total_count = 0;
+
/* find matching packages... */
IdList* result = NULL;
if (argc <= 1)
@@ -57,11 +59,12 @@
exit(1);
}
}
- if (!result || (result->size() == 0)) {
+ if (!result ) { //|| (result->size() == 0)) {
/* FIXME: use a list of all packages here */
cerr << "No matching packages found." << endl;
exit(1);
}
+ total_count = result->size();
/* for all packages, find tags assigned to them */
map<dbid, unsigned int> tags;
@@ -149,7 +152,11 @@
cerr << "Unknown pkg id: " << i->id << endl;
}
}
- cout << "]";
+ cout << "]" << ",";
+ cout << "\"stats\":{";
+ cout << "\"packages\":" << remaining_pkgs.size() << ",";
+ cout << "\"totalpkgs\":" << total_count;
+ cout << "}";
cout << "}";
return(0);
More information about the Debtags-commits
mailing list