witten
/
luminotes
Archived
1
0
Fork 0

Changing the storage usage calculation algorithm to not count old notebook revisions.

This commit is contained in:
Dan Helfman 2007-09-21 19:15:02 +00:00
parent c5a2b3900f
commit 13bc06295f
2 changed files with 2 additions and 5 deletions

View File

@ -343,7 +343,7 @@ class Users( object ):
def sum_notebook( notebook ):
return \
sum_revisions( notebook ) + \
self.__database.size( notebook.object_id ) + \
sum( [ sum_revisions( note ) for note in notebook.notes ], 0 )
for notebook in user.notebooks:

View File

@ -213,9 +213,7 @@ class Test_users( Test_controller ):
# expected a sum of the sizes of all of this user's notebooks, notes, and revisions
expected_size = \
self.database.size( notebooks[ 0 ].object_id ) + \
self.database.size( notebooks[ 0 ].object_id, notebooks[ 0 ].revision ) + \
self.database.size( notebooks[ 1 ].object_id ) + \
self.database.size( notebooks[ 1 ].object_id, notebooks[ 1 ].revision )
self.database.size( notebooks[ 1 ].object_id )
assert size == expected_size
@ -224,7 +222,6 @@ class Test_users( Test_controller ):
expected_size = \
self.database.size( self.anon_notebook.object_id ) + \
self.database.size( self.anon_notebook.object_id, self.anon_notebook.revision ) + \
self.database.size( self.anon_notebook.notes[ 0 ].object_id ) + \
self.database.size( self.anon_notebook.notes[ 0 ].object_id, self.anon_notebook.notes[ 0 ].revision )