Changing the storage usage calculation algorithm to not count old notebook revisions.
This commit is contained in:
parent
c5a2b3900f
commit
13bc06295f
|
@ -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:
|
||||
|
|
|
@ -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 )
|
||||
|
||||
|
|
Reference in New Issue