How to use the result.models.Result.objects.filter function in result

To help you get started, we’ve selected a few result examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bioinformatics-ua / taska / workflowmanagement / process / views / ResultsPDF.py View on Github external
def get(self, request, hash):
        from result.models import Result

        ptask = get_object_or_404(ProcessTask, hash=hash)

        if not (
                request.user == ptask.process.executioner
                or ptask.process.workflow.workflowpermission.public
            ):
            raise Http404

        users = ptask.users().values_list('id', flat=True)


        results = Result.objects.filter(removed=False, processtaskuser__in=users).select_subclasses()

        tasktype = ptask.task.subclass()
        schema=None

        if tasktype.type() == 'form.FormTask':
            schema = tasktype.form.schema

        context = {
            'STATIC_URL': settings.STATIC_URL,
            'processtask': ptask,
            'schema' : schema,
            'results': results,
            'status': ProcessTask.statusCode(ptask.status)
        }
github bioinformatics-ua / taska / workflowmanagement / process / api.py View on Github external
def get(self, request, hash):
        from result.models import Result

        ptask = get_object_or_404(ProcessTask, hash=hash)

        if not (
                request.user == ptask.process.executioner
                or ptask.process.workflow.workflowpermission.public
            ):
            raise Http404

        users = ptask.users().values_list('id', flat=True)


        results = Result.objects.filter(removed=False, processtaskuser__in=users).select_subclasses()

        tasktype = ptask.task.subclass()
        schema=None

        if tasktype.type() == 'form.FormTask':
            schema = tasktype.form.schema

        context = {
            'STATIC_URL': settings.STATIC_URL,
            'processtask': ptask,
            'schema' : schema,
            'results': results,
            'status': ProcessTask.statusCode(ptask.status)
        }
github Abdoulrasheed / django-school-management / result / models.py View on Github external
def calculate_cgpa(self):
        current_semester = Semester.objects.get(is_current_semester=True)
        previousResult = Result.objects.filter(student__id=self.student.id, level__lt=self.student.level)
        previousCGPA = 0
        for i in previousResult:
            if i.cgpa is not None:
                previousCGPA += i.cgpa
        cgpa = 0
        if str(current_semester) == SECOND:
            try:
                first_sem_gpa = Result.objects.get(student=self.student.id, semester=FIRST, level=self.student.level) 
                first_sem_gpa += first_sem_gpa.gpa.gpa
            except:
                first_sem_gpa = 0

            try:
                sec_sem_gpa = Result.objects.get(student=self.student.id, semester=SECOND, level=self.student.level) 
                sec_sem_gpa += sec_sem_gpa.gpa
            except: