Пример #1
0
    def create(self,request):
        self.file_name = request.POST['file_name']
        self.issue_desc = request.POST['description']
        self.line = request.POST['line']
        self.column = request.POST['column']
        self.severity = request.POST['severity']
        self.build_name = request.POST['build_name']
        self.build_revision = request.POST['build_revision']
        self.cons = Issue.objects.filter(file_name = self.file_name, description = self.issue_desc, line= self.line, column = self.column)
        if ( len(self.cons) == 0 ):
            """ issue not present in the database to be added
            """
            pass 
            build_objs = Build.objects.filter(name=self.build_name, revision = self.build_revision)
            if len( build_objs ) == 0:
                return HttpResponse("Build Doesnot Exist")
            else:
                issue = Issue(file_name = self.file_name, description = self.issue_desc, severity= self.severity, line = self.line, column = self.column)
                issue.save()
                issue.build.add(build_objs[0])
                return HttpResponse("Issue Added")
        else:
            """ issue present in the database to be build added
            """
            build_objs = Build.objects.filter(name=self.build_name, revision = self.build_revision)
            if len( build_objs ) == 0:
                return HttpResponse("Build Doesnot Exist")
            else:
                self.cons[0].build.add(build_objs[0])
                return HttpResponse("Issue added to the Build")

            pass 
Пример #2
0
def update_issue_command(file_n, issue_desc, ln, col, sev, build_name, build_revision):
        cons = Issue.objects.filter(file_name = file_n, description = issue_desc, line= ln, column = col)
        if ( len(cons) == 0 ):
            """ issue not present in the database to be added
            """
            pass
            build_objs = Build.objects.filter(name=build_name, revision = build_revision)
            if len( build_objs ) == 0:
                return str("Build Doesnot Exist")
            else:
                issue = Issue(file_name = file_n, description = issue_desc, severity= sev, line = ln, column = col)
                issue.save()
                issue.build.add(build_objs[0])
                return str("Issue Added")
        else:
            """ issue present in the database to be build added
            """
            build_objs = Build.objects.filter(name=build_name, revision = build_revision)
            if len( build_objs ) == 0:
                return str("Build Doesnot Exist")
            else:
                cons[0].build.add(build_objs[0])
                return str("Issue added to the Build")
            pass