Browse Source

Remove unused code from old saberes dashboard

producao
Marcio Mazza 10 years ago
parent
commit
65ff5105fe
  1. 57
      sigi/apps/saberes/views.py

57
sigi/apps/saberes/views.py

@ -1,16 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from collections import OrderedDict
import requests import requests
from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import render, render_to_response, get_object_or_404 from django.shortcuts import render
from django.template import RequestContext
from django.utils.translation import ugettext as _
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt
from requests.auth import HTTPBasicAuth from requests.auth import HTTPBasicAuth
from sigi.apps.mdl.models import CourseStats
from sigi.apps.saberes.models import CategoriasInteresse
from sigi.settings import PENTAHO_SERVER, PENTAHO_DASHBOARDS, PENTAHO_USERNAME_PASSWORD from sigi.settings import PENTAHO_SERVER, PENTAHO_DASHBOARDS, PENTAHO_USERNAME_PASSWORD
@ -54,52 +48,3 @@ def pentaho_proxy(request, path):
return HttpResponse(response.content, return HttpResponse(response.content,
status=response.status_code, status=response.status_code,
content_type=response.headers.get('Content-Type')) content_type=response.headers.get('Content-Type'))
def detail(request, area):
ci = get_object_or_404(CategoriasInteresse, pk=area)
head_flags = []
table_data = OrderedDict()
for c in CourseStats.objects.filter(category__in=ci.categorias(subcategorias=True)).order_by('course__fullname'):
if c.course_id not in table_data:
table_data[c.course_id] = {'course_name': c.course.fullname, 'total_matriculas': 0}
table_data[c.course_id]['total_matriculas'] += c.usercount
table_data[c.course_id][c.completionstatus] = c.usercount
head_flags.append(c.completionstatus)
if c.completionstatus == 'A':
table_data[c.course_id]['media_aprovados'] = c.gradeaverage
head_flags.append('MA')
if c.completionstatus == 'R':
table_data[c.course_id]['media_reprovados'] = c.gradeaverage
head_flags.append('MR')
head_flags = set(head_flags)
table_head = [_(u'Curso / turma'), _(u'Total de matrículas')]
if 'N' in head_flags:
table_head.append(_(u'Matrículas rejeitadas'))
table_head.append(_(u'Alunos efetivos'))
for k in table_data:
table_data[k]['efetivos'] = table_data[k]['total_matriculas'] - (table_data[k]['N'] if 'N' in table_data[k] else 0)
if 'C' in head_flags:
table_head.append(_(u'Em curso'))
if 'L' in head_flags:
table_head.append(_(u'Abandono'))
if 'R' in head_flags:
table_head.append(_(u'Reprovação'))
if 'A' in head_flags:
table_head.append(_(u'Aprovação'))
if 'MA' in head_flags:
table_head.append(_(u'Média das notas dos alunos aprovados'))
if 'MR' in head_flags:
table_head.append(_(u'Média das notas dos alunos reprovados'))
extra_context = {'area': ci, 'table_head': table_head, 'table_data': table_data, 'flags': head_flags}
return render_to_response('saberes/detail.html', extra_context, context_instance=RequestContext(request))

Loading…
Cancel
Save