From 0504fbeb92e83e92e1f1bc6e003bdb3f93c4318f Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 31 Mar 2011 01:48:19 -0500 Subject: Collapse all split and similar packages in recent updates list I was getting sick of seeing the *-i18n packages completely blow away anything else useful out of the recent updates sidebar. Revamp the logic here again to do something about it. As we did before, grab packages from the database and attempt to group them, but this time do it by only repo and pkgbase. From there, if we have packages in the group with a pkgname matching pkgbase, we will link just those. If not, we will create some stub objects that link to our relatively new virtual package overview screen. Signed-off-by: Dan McGee --- templates/public/index.html | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'templates/public') diff --git a/templates/public/index.html b/templates/public/index.html index 1f4b2ce5..132412f6 100644 --- a/templates/public/index.html +++ b/templates/public/index.html @@ -80,15 +80,13 @@

Recent Updates ( {% for update in pkg_updates %} - {% with update|first as fpkg %} - {{ fpkg.pkgname }} {{ fpkg.full_version }} - - {% for pkg in update %}{{ update.pkgbase }} {{ update.version }} + + {% for pkg in update.package_links %}{{ pkg.arch }}{% if not forloop.last %}/{% endif %}{% endfor %} - {% endwith %} {% endfor %} -- cgit v1.2.3-54-g00ecf From c292dcfc6bf96ebf5f34342beb1367aa5361f7c4 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Thu, 28 Apr 2011 13:19:42 -0500 Subject: isotests: various changes and updates * isotests/fixtures/clockchoices.json: changed 'default' to 'unchanged' * isotests/fixtures/filesystems.json: removed 'check the installed system' line from one of the options * isotests/fixtures/modules.json: added 'ext2','ext3','ext4','swap','xfs','jfs','reiserFS' * isotests/models.py: * Added RollbackOption abstract class that adds the functions get_rollback_success_test and get_rollback_failed_test on top of the IsoOption abstract class for use with the Filesystem and Module classes since Test uses these both in 2 ways (regular and rollback). This keeps them seperated. * renamed the related names of these properties from rollback_test to rollback_test_set (seems more in-tune with the other relations) * isotests/views.py: * changed the order of the fields, the automatic order makes no sense. * Added help texts to the fields success, filesystem, rollback_filesystem and rollback_modules. * Removed help text from modules (made no sense) * Added a website field, should remain empty, a simplistic way to hopefully reduce spambot entries. * templates/isotests/results.html: * Removed the rollback yes/no section * The rollback labels should check get_rollback_success_test and get_rollback_failed_test. * Rollback checkbox removed. * Clearly tell users that success must only be selected if everything works right. * Clearly tell users to only fill in the rollback options if they did a rollback. * Added a thanks page that tells people thanks. * Added links between the pages. * Added links to lists with tests of either a specific iso or of any iso where a specific option was selected. Signed-off-by: Dan McGee Conflicts: templates/isotests/results.html --- isotests/fixtures/clockchoices.json | 2 +- isotests/fixtures/filesystems.json | 2 +- isotests/fixtures/modules.json | 49 +++ isotests/models.py | 51 +++- isotests/urls.py | 8 +- isotests/views.py | 64 +++- templates/isotests/add.html | 2 + templates/isotests/result_list.html | 34 +++ templates/isotests/results.html | 595 +++++++++++++++++++++++++----------- templates/isotests/thanks.html | 14 + templates/public/index.html | 2 + 11 files changed, 616 insertions(+), 207 deletions(-) create mode 100644 templates/isotests/result_list.html create mode 100644 templates/isotests/thanks.html (limited to 'templates/public') diff --git a/isotests/fixtures/clockchoices.json b/isotests/fixtures/clockchoices.json index 2c078128..6dfd06e1 100644 --- a/isotests/fixtures/clockchoices.json +++ b/isotests/fixtures/clockchoices.json @@ -3,7 +3,7 @@ "pk": 1, "model": "isotests.clockchoice", "fields": { - "name": "default" + "name": "unchanged" } }, { diff --git a/isotests/fixtures/filesystems.json b/isotests/fixtures/filesystems.json index 4d3f1bc4..5386c391 100644 --- a/isotests/fixtures/filesystems.json +++ b/isotests/fixtures/filesystems.json @@ -3,7 +3,7 @@ "pk": 1, "model": "isotests.filesystem", "fields": { - "name": "autoprepare (check the installed system, incl fstab)" + "name": "autoprepare" } }, { diff --git a/isotests/fixtures/modules.json b/isotests/fixtures/modules.json index 27d04c7a..ae8a1683 100644 --- a/isotests/fixtures/modules.json +++ b/isotests/fixtures/modules.json @@ -33,5 +33,54 @@ "fields": { "name": "btrfs" } + }, + { + "pk": 6, + "model": "isotests.module", + "fields": { + "name": "ext2" + } + }, + { + "pk": 7, + "model": "isotests.module", + "fields": { + "name": "ext3" + } + }, + { + "pk": 8, + "model": "isotests.module", + "fields": { + "name": "ext4" + } + }, + { + "pk": 9, + "model": "isotests.module", + "fields": { + "name": "swap" + } + }, + { + "pk": 10, + "model": "isotests.module", + "fields": { + "name": "xfs" + } + }, + { + "pk": 11, + "model": "isotests.module", + "fields": { + "name": "jfs" + } + }, + { + "pk": 12, + "model": "isotests.module", + "fields": { + "name": "reiserFS" + } } ] diff --git a/isotests/models.py b/isotests/models.py index bffb2d94..ae5bf96f 100644 --- a/isotests/models.py +++ b/isotests/models.py @@ -7,19 +7,49 @@ class Meta: name = models.CharField(max_length=200) + success_tests = None + failed_tests = None + def __unicode__(self): return str(self.name) def get_success_test(self): - test = self.test_set.filter(success=True).annotate(Max('iso__id')) - if test: - return test[0].iso.name + if not self.success_tests: + self.success_tests = self.test_set.filter(success=True).annotate(Max('iso__id')) + + if self.success_tests: + return self.success_tests[0].iso return None def get_failed_test(self): - test = self.test_set.filter(success=False).annotate(Max('iso__id')) - if test: - return test[0].iso.name + if not self.failed_tests: + self.failed_tests = self.test_set.filter(success=False).annotate(Max('iso__id')) + + if self.failed_tests: + return self.failed_tests[0].iso + return None + +class RollbackOption(IsoOption): + class Meta: + abstract = True + + success_rollback_tests = None + failed_rollback_tests = None + + def get_rollback_success_test(self): + if not self.success_rollback_tests: + self.success_rollback_tests = self.rollback_test_set.filter(success=True).annotate(Max('iso__id')) + + if self.success_rollback_tests: + return self.success_rollback_tests[0].iso + return None + + def get_rollback_failed_test(self): + if not self.failed_rollback_tests: + self.failed_rollback_tests = self.rollback_test_set.filter(success=False).annotate(Max('iso__id')) + + if self.failed_rollback_tests: + return self.failed_rollback_tests[0].iso return None class Iso(models.Model): @@ -50,10 +80,10 @@ class Source(IsoOption): class ClockChoice(IsoOption): pass -class Filesystem(IsoOption): +class Filesystem(RollbackOption): pass -class Module(IsoOption): +class Module(RollbackOption): pass class Bootloader(IsoOption): @@ -72,11 +102,10 @@ class Test(models.Model): clock_choice = models.ForeignKey(ClockChoice) filesystem = models.ForeignKey(Filesystem) modules = models.ManyToManyField(Module, null=True, blank=True) - rollback = models.BooleanField() rollback_filesystem = models.ForeignKey(Filesystem, - related_name="rollback_test", null=True, blank=True) + related_name="rollback_test_set", null=True, blank=True) rollback_modules = models.ManyToManyField(Module, - related_name="rollback_test", null=True, blank=True) + related_name="rollback_test_set", null=True, blank=True) bootloader = models.ForeignKey(Bootloader) success = models.BooleanField() comments = models.TextField(null=True, blank=True) diff --git a/isotests/urls.py b/isotests/urls.py index f60f0bc9..7f438368 100644 --- a/isotests/urls.py +++ b/isotests/urls.py @@ -1,8 +1,12 @@ from django.conf.urls.defaults import patterns urlpatterns = patterns('isotests.views', - (r'^$', 'view_results'), - (r'^add/$', 'add_result') + (r'^$', 'view_results'), + (r'^add/$', 'add_result'), + (r'^thanks/$', 'thanks'), + (r'^results/$', 'view_results'), + (r'^results/(?P