Skip to content

Commit

Permalink
Moved current_version clearing to top before deleting versions
Browse files Browse the repository at this point in the history
  • Loading branch information
robhudson committed Nov 21, 2012
1 parent 7b2888f commit 1e26ea1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mkt/zadmin/management/commands/collapse_versions.py
Expand Up @@ -48,6 +48,12 @@ def do_collapsing():
print 'No older versions found.'
continue

# Clear the current_version. It gets re-set when we're done.
cursor.execute('''
UPDATE addons SET current_version=NULL
WHERE id=%s''', (app.id,))
print 'Cleared current_version for app [%s]' % app.id

for old_version in old_versions:

# Hosted app reviews' version column is always NULL.
Expand Down Expand Up @@ -185,7 +191,6 @@ def do_collapsing():
file_.update(reviewed=version.reviewed)

# Call `update_version` to set the current_version properly.
app.update(_current_version=None)
updated = app.update_version()

# Call app.save to invalidate and re-index, etc.
Expand Down

0 comments on commit 1e26ea1

Please sign in to comment.