cope with multiple runs and different apps a little better (bug 651294)
This commit is contained in:
Родитель
1f311e7104
Коммит
a4a44a89b5
|
@ -84,8 +84,10 @@ def set_max_versions(version_pks, job_pk, **kw):
|
|||
% (version.pk, version.addon.pk))
|
||||
continue
|
||||
|
||||
for app in version.apps.all():
|
||||
if app.max == job.curr_max_version:
|
||||
for app in version.apps.filter(application=
|
||||
job.curr_max_version.application):
|
||||
if (app.max.version == job.curr_max_version.version and
|
||||
job.target_version.version != app.max.version):
|
||||
log.info('Updating version %s for addon %s from version %s '
|
||||
'to version %s'
|
||||
% (version.pk, version.addon.pk,
|
||||
|
|
|
@ -254,6 +254,21 @@ class TestBulkUpdate(BulkValidationTest):
|
|||
self.client.post(self.update_url)
|
||||
eq_(self.version.apps.all()[0].max, self.appversion('3.6'))
|
||||
|
||||
def test_update_different_app(self):
|
||||
self.create_result(self.job, self.create_file(self.version))
|
||||
target = self.version.apps.all()[0]
|
||||
target.application_id = amo.FIREFOX.id
|
||||
target.save()
|
||||
eq_(self.version.apps.all()[0].max, self.curr_max)
|
||||
|
||||
def test_update_twice(self):
|
||||
self.create_result(self.job, self.create_file(self.version))
|
||||
self.client.post(self.update_url)
|
||||
eq_(self.version.apps.all()[0].max, self.job.target_version)
|
||||
now = self.version.modified
|
||||
self.client.post(self.update_url)
|
||||
eq_(self.version.modified, now)
|
||||
|
||||
|
||||
class TestBulkNotify(BulkValidationTest):
|
||||
|
||||
|
|
|
@ -205,11 +205,10 @@ def start_validation(request):
|
|||
def completed_versions_dirty(job):
|
||||
"""Given a job, calculate which unique versions could need updating."""
|
||||
return (Version.objects
|
||||
.filter(files__validation_results__validation_job=job)
|
||||
.filter(files__validation_results__errors=0)
|
||||
.filter(files__validation_results__completed__isnull=False)
|
||||
.values_list('pk', flat=True)
|
||||
.distinct())
|
||||
.filter(files__validation_results__validation_job=job,
|
||||
files__validation_results__errors=0,
|
||||
files__validation_results__completed__isnull=False)
|
||||
.values_list('pk', flat=True).distinct())
|
||||
|
||||
|
||||
@post_required
|
||||
|
|
Загрузка…
Ссылка в новой задаче