Merge lp://qastaging/~jml/libdep-service/summary-pages into lp://qastaging/libdep-service

Proposed by Jonathan Lange
Status: Merged
Approved by: James Westby
Approved revision: 71
Merged at revision: 45
Proposed branch: lp://qastaging/~jml/libdep-service/summary-pages
Merge into: lp://qastaging/libdep-service
Diff against target: 449 lines (+318/-34)
9 files modified
django_project/urls.py (+1/-0)
djlibdep/api.py (+59/-0)
djlibdep/templates/homepage.html (+4/-0)
djlibdep/tests/__init__.py (+30/-3)
djlibdep/tests/helpers.py (+48/-0)
djlibdep/tests/test_api.py (+120/-0)
djlibdep/tests/test_views.py (+37/-31)
djlibdep/views.py (+5/-0)
djlibdep/wrappers.py (+14/-0)
To merge this branch: bzr merge lp://qastaging/~jml/libdep-service/summary-pages
Reviewer Review Type Date Requested Status
James Westby (community) Approve
Review via email: mp+123314@code.qastaging.launchpad.net

Commit message

Add API for showing statistics about the database

Description of the change

Adds an API for showing summary information about the database.

Can't remember the interesting bits, I'm afraid.

Good luck!

jml

To post a comment you must log in.
Revision history for this message
James Westby (james-w) wrote :

67 +def get_unique_packages(db):
68 + result = db._store.execute(
69 + "SELECT COUNT(DISTINCT dependency) FROM libdep")
70 + return int(list(result)[0][0])

I'm not sure I think of this as packages, because that might be confused
with the number of packages that we have information for. They will
be close numbers, but can potentially differ.

We also should have versions etc. in these dependencies some times, which
will change the results.

I also wonder if we want the number of scanned packages, i.e. a
DISTINCT of 'source_package_name'.

My proposal:

  * Rename the above to 'dependencies'
  * Add another 'packages', though maybe with a different name to reduce confusion
    (though source_package_name as it is called in the db is not what they are).

102 +class NonSuite(object):

A comment somewhere around this code explaining what it is accomplishing, and
why it has to be done this way would be very much appreciated.

Thanks,

James

65. By Jonathan Lange

Docstring.

66. By Jonathan Lange

More comments.

67. By Jonathan Lange

Fix PEP 8

68. By Jonathan Lange

Rename 'packages' to 'dependnencies'

69. By Jonathan Lange

dependencies, not packages

--------------This line and the following will be ignored --------------

modified:
  djlibdep/api.py
  djlibdep/tests/test_api.py

=== modified file 'djlibdep/api.py'
--- a/djlibdep/api.py 2012-09-10 15:50:21 +0000
+++ b/djlibdep/api.py 2012-09-10 15:51:36 +0000
@@ -37,7 +37,7 @@
         'architectures': get_architecture_counts(db),
         'total': get_total_rows(db),
         'libraries': get_unique_libraries(db),
- 'dependencies': get_unique_packages(db),
+ 'dependencies': get_unique_dependencies(db),
         }

@@ -58,7 +58,7 @@
     return int(list(result)[0][0])

-def get_unique_packages(db):
+def get_unique_dependencies(db):
     result = db._store.execute(
         "SELECT COUNT(DISTINCT dependency) FROM libdep")
     return int(list(result)[0][0])

=== modified file 'djlibdep/tests/test_api.py'
--- a/djlibdep/tests/test_api.py 2012-09-10 15:50:21 +0000
+++ b/djlibdep/tests/test_api.py 2012-09-10 15:51:28 +0000
@@ -19,7 +19,7 @@
     get_summary,
     get_total_rows,
     get_unique_libraries,
- get_unique_packages,
+ get_unique_dependencies,
     )
 from .helpers import (
     populate_sample_data,
@@ -85,12 +85,12 @@

     def test_empty_db(self):
         db = self.get_package_db()
- self.assertEqual(0, get_unique_packages(db))
+ self.assertEqual(0, get_unique_dependencies(db))

     def test_mix_it_up(self):
         db = self.get_package_db()
         populate_sample_data(db, SAMPLE_DATA)
- self.assertEqual(3, get_unique_packages(db))
+ self.assertEqual(3, get_unique_dependencies(db))

 class TestUniqueLibraries(TestCase, WithDatabase):

70. By Jonathan Lange

Thing to scan packages.

71. By Jonathan Lange

Minor refactoring. Add to summary.

Revision history for this message
Jonathan Lange (jml) wrote :

Changed, as you suggest.

Revision history for this message
James Westby (james-w) wrote :

Great, thanks.

James

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches