diff options
Diffstat (limited to 'python/tbc_www')
-rw-r--r-- | python/tbc_www/models.py | 22 | ||||
-rw-r--r-- | python/tbc_www/views.py | 34 |
2 files changed, 48 insertions, 8 deletions
diff --git a/python/tbc_www/models.py b/python/tbc_www/models.py index 9827583..621a7dc 100644 --- a/python/tbc_www/models.py +++ b/python/tbc_www/models.py @@ -80,8 +80,6 @@ class BuildLogs(models.Model): BuildLogId = models.IntegerField(primary_key=True, db_column='build_log_id') EbuildId = models.ForeignKey(Ebuilds, db_column='ebuild_id') Fail = models.BooleanField(db_column='fail') - RmQa = models.BooleanField(db_column='rmqa') - Others = models.BooleanField(db_column='others') SummeryText = models.TextField(db_column='summery_text') LogHash = models.CharField(max_length=100, db_column='log_hash') BugId = models.IntegerField( db_column='bug_id') @@ -89,7 +87,7 @@ class BuildLogs(models.Model): class Meta: db_table = 'build_logs' def __str__(self): - return '%s %s %s %s %s %s %s %s %s' % (self.BuildLogId, self.EbuildId, self.Fail, self.RmQa, self.Others, self.SummeryText, self.LogHash, self.BugId, self.TimeStamp) + return '%s %s %s %s %s %s %s' % (self.BuildLogId, self.EbuildId, self.Fail, self.SummeryText, self.LogHash, self.BugId, self.TimeStamp) class BuildLogsRepomanQa(models.Model): Id = models.IntegerField(primary_key=True, db_column='id') @@ -100,6 +98,24 @@ class BuildLogsRepomanQa(models.Model): def __str__(self): return '%s %s %s' % (self.Id, self.BuildLogId, self.SummeryText) +class ErrorsInfo(models.Model): + ErrorId = models.IntegerField(primary_key=True, db_column='error_id') + ErrorName = models.CharField(max_length=20, db_column='error_name') + ErrorSearch = models.CharField(max_length=30, db_column='error_search') + class Meta: + db_table = 'errors_info' + def __str__(self): + return '%s %s %s' % (self.ErrorId, self.ErrorName, self.ErrorSearch) + +class BuildLogsErrors(models.Model): + Id = models.IntegerField(primary_key=True, db_column='id') + BuildLogId = models.ForeignKey(BuildLogs, db_column='build_log_id') + ErrorId = models.ForeignKey(ErrorsInfo, db_column='error_id') + class Meta: + db_table = 'build_logs_errors' + def __str__(self): + return '%s %s %s' % (self.Id, self.BuildLogId, self.ErrorId) + class Setups(models.Model): SetupId = models.AutoField(primary_key=True, db_column='setup_id') Setup = models.CharField(max_length=100, db_column='setup') diff --git a/python/tbc_www/views.py b/python/tbc_www/views.py index 2559f8d..f68a706 100644 --- a/python/tbc_www/views.py +++ b/python/tbc_www/views.py @@ -7,7 +7,7 @@ from django.conf import settings from gentoo_www.models import SiteSettings, Layout, Pages, SubPages, Sponsors, Posts from tbc_www.models import EbuildsMetadata, BuildLogs, BuildJobs, BuildLogsRepomanQa, \ BuildJobsUse, Categories, CategoriesMetadata, Packages, PackagesMetadata, Ebuilds, \ - Repos, EbuildsKeywords + Repos, EbuildsKeywords, BuildLogsErrors import re def default_TmpDict(pagerequest): @@ -30,10 +30,22 @@ def default_TmpDict(pagerequest): def home(request): pagerequest = 'home' Lines = 5 - adict = {} TmpDict = default_TmpDict(pagerequest) TmpDict['EM'] = EbuildsMetadata.objects.filter(Revision = '1.1').order_by('-Id')[:Lines] - TmpDict['BL'] = BuildLogs.objects.order_by('-TimeStamp')[:Lines] + adict = {} + for BL in BuildLogs.objects.order_by('-TimeStamp')[:Lines]: + adict2 = {} + adict2['C'] = BL.EbuildId.PackageId.CategoryId.Category + adict2['P'] = BL.EbuildId.PackageId.Package + adict2['V'] = BL.EbuildId.Version + adict2['R'] = BL.EbuildId.PackageId.RepoId.Repo + adict2['Fail'] = BL.Fail + adict2['SummeryText'] = BL.SummeryText + if BL.Fail: + adict2['BE_tmp'] = BuildLogsErrors.objects.filter(BuildLogId = BL.BuildLogId) + adict[BL.BuildLogId] = adict2 + TmpDict['BL'] = adict + adict = {} BJ_Tmp = BuildJobs.objects.order_by('-TimeStamp')[:Lines] for BJ in BJ_Tmp: adict2 = {} @@ -115,10 +127,22 @@ def ebuilds(request, package_id): def new_main(request): pagerequest = 'new' Lines = 30 - adict = {} TmpDict = default_TmpDict(pagerequest) TmpDict['EM'] = EbuildsMetadata.objects.filter(Revision = '1.1').order_by('-Id')[:Lines] - TmpDict['BL'] = BuildLogs.objects.order_by('-TimeStamp')[:Lines] + adict = {} + for BL in BuildLogs.objects.order_by('-TimeStamp')[:Lines]: + adict2 = {} + adict2['C'] = BL.EbuildId.PackageId.CategoryId.Category + adict2['P'] = BL.EbuildId.PackageId.Package + adict2['V'] = BL.EbuildId.Version + adict2['R'] = BL.EbuildId.PackageId.RepoId.Repo + adict2['Fail'] = BL.Fail + adict2['SummeryText'] = BL.SummeryText + if BL.Fail: + adict2['BE_tmp'] = BuildLogsErrors.objects.filter(BuildLogId = BL.BuildLogId) + adict[BL.BuildLogId] = adict2 + TmpDict['BL'] = adict + adict = {} BJ_Tmp = BuildJobs.objects.order_by('-TimeStamp')[:Lines] for BJ in BJ_Tmp: adict2 = {} |