Skip to content

Commit

Permalink
Migrations: Fix a broken migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
jleclanche committed Jan 16, 2015
1 parent 5092205 commit 6081bbe
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions pootle/apps/pootle_store/migrations/0021_set_reviewer_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,25 @@ def forwards(self, orm):

cur_id = None
processed_id = None

skip_types = [
SubmissionTypes.MUTE_CHECK,
SubmissionTypes.UNMUTE_CHECK,
SubmissionTypes.SUGG_ADD,
SubmissionTypes.SUGG_REJECT,
]

for s in ss:
if (processed_id != s.unit_id and
(cur_id != s.unit_id or s.type in skip_types or
s.field == SubmissionFields.COMMENT)):

cur_id = s.unit_id

if s.field == SubmissionFields.TARGET:
if s.type == SubmissionTypes.SUGG_ACCEPT:
s.unit.reviewed_by = s.submitter
s.unit.reviewed_on = s.creation_time
s.unit.save()
processed_id = cur_id
elif s.field == SubmissionFields.TARGET:
processed_id = cur_id

if s.type == SubmissionTypes.SUGG_ACCEPT:
s.submitter = s.suggestion.reviewer
s.unit.reviewed_by = s.submitter
s.unit.reviewed_on = s.creation_time
s.save()
s.unit.save()

def backwards(self, orm):
pass
Expand Down

0 comments on commit 6081bbe

Please sign in to comment.