# Path: src/app/models.py
# class Build(models.Model):
# 
#     class Meta:
#         db_table = 'builds'
# 
#     number = models.IntegerField()
#     job = models.ForeignKey(Job, related_name="builds")
#     created = models.DateTimeField(auto_now_add=True)
#     result = models.TextField(default="")
# 
#     def __str__(self):
#         return "{0}:{1}".format(self.job.name, self.number)
# 
# class Job(models.Model):
# 
#     class Meta:
#         db_table = 'jobs'
# 
#     name = models.CharField(unique=True, max_length=250)
#     description = models.TextField(blank=True, default='')
#     svn_url = models.TextField()
#     svn_username = models.TextField(blank=True, default='')
#     svn_password = models.TextField(blank=True, default='')
# 
#     recipient = models.TextField()
#     violation_threshold_num = models.IntegerField(default=888)
# 
#     def __str__(self):
#         return self.name


import json
import logging
import time
from django.conf import settings
from django_q.tasks import Async
from djmail.template_mail import InlineCSSTemplateMail
from lintjenkins import LintJenkins
from .models import Build, Job

# -*- encoding: utf-8 -*-





logger = logging.getLogger('jenkins')


def update_build_info():
    lint_jenkins = LintJenkins(settings.JENKINS_URL,
                               username=settings.JENKINS_USER,
                               password=settings.JENKINS_TOKEN)

# Path: src/app/models.py
# class Build(models.Model):
# 
#     class Meta:
#         db_table = 'builds'
# 
#     number = models.IntegerField()
#     job = models.ForeignKey(Job, related_name="builds")
#     created = models.DateTimeField(auto_now_add=True)
#     result = models.TextField(default="")
# 
#     def __str__(self):
#         return "{0}:{1}".format(self.job.name, self.number)
# 
# class Job(models.Model):
# 
#     class Meta:
#         db_table = 'jobs'
# 
#     name = models.CharField(unique=True, max_length=250)
#     description = models.TextField(blank=True, default='')
#     svn_url = models.TextField()
#     svn_username = models.TextField(blank=True, default='')
#     svn_password = models.TextField(blank=True, default='')
# 
#     recipient = models.TextField()
#     violation_threshold_num = models.IntegerField(default=888)
# 
#     def __str__(self):
#         return self.name


# Path: src/app/tasks.py
import json
import logging
import time
from django.conf import settings
from django_q.tasks import Async
from djmail.template_mail import InlineCSSTemplateMail
from lintjenkins import LintJenkins
from .models import Build, Job

# -*- encoding: utf-8 -*-





logger = logging.getLogger('jenkins')


def update_build_info():
    lint_jenkins = LintJenkins(settings.JENKINS_URL,
                               username=settings.JENKINS_USER,
                               password=settings.JENKINS_TOKEN)

    for job in Job.objects.all():
