Commit ddc6ab74 authored by Jomaro Rodrigues's avatar Jomaro Rodrigues

listagem geral de matérias funcionando com as informações extras

parent 55dce8f9
......@@ -42,11 +42,8 @@ class AnalysisManager():
print('rodando %s para %s' % (analysis, review))
analysis.do(review, dao)
#print("OK")
print("Finalizando")
......
......@@ -7,5 +7,4 @@ urlpatterns = patterns('',
url(r'^optativas/$', views.optativas, name='optativas'),
url(r'^tcc/$', views.tcc, name='tcc'),
url(r'^(?P<code>\w+)/$', views.detail_discipline, name='detail'),
url(r'^imagem/(?P<image_path>\w+[.]\w+)$', views.image, name='image'),
)
from __future__ import unicode_literals
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.http import HttpResponse, JsonResponse
from django.core.urlresolvers import reverse
from django.shortcuts import redirect, render
import pandas as pd
......@@ -24,11 +24,11 @@ def index(request):
dao.load('obrigatorias')
#materias_maior_reprovacao = sorted(review.obrigatorias, key=lambda x: x['p_reprovado'], reverse=True)[:7]
materias_maior_reprovacao = review.obrigatorias.sort(columns='p_reprovado', ascending=False)[:7]
data = {
'materias' : review.obrigatorias,
#'mat_rep' : materias_maior_reprovacao,
'materias': review.obrigatorias,
'mat_rep': materias_maior_reprovacao,
}
return render(request, 'materias/index.html', data)
......@@ -70,23 +70,3 @@ def tcc(request):
return render(request, '', {})
@login_required
def image(request, image_path):
review = request.session['current_review']
image = open(review.results_path() + 'images/' + image_path)
response = HttpResponse(content_type="image/svg+xml")
response.write(image.read())
return response
#return Http404()
......@@ -133,7 +133,7 @@ class GraficoMateriasMaiorReprovacao(Analysis):
n = 7
dao.load('materias')
dao.load('obrigatorias')
df = review.materias.sort('p_reprovado', ascending=False)[:n]
......
......@@ -69,20 +69,6 @@ class ReviewDAO:
if not hasattr(self.review, 'materias'):
self.review.materias = pd.read_csv(self.review.results_path() + 'materias.csv')
def load_raw_historico(self):
if not hasattr(self.review, 'raw_historico'):
self.review.raw_historico = pd.read_csv(self.review.uploads_path() + 'raw_historico.csv')
def load_raw_matricula(self):
if not hasattr(self.review, 'raw_matricula'):
self.review.raw_matricula = pd.read_csv(self.review.uploads_path() + 'raw_matricula.csv')
def store_raw_matricula(self):
self.review.raw_matricula.to_csv(self.review.uploads_path() + 'raw_matricula.csv', index=False)
def store_raw_historico(self):
self.review.raw_historico.to_csv(self.review.uploads_path() + 'raw_historico.csv', index=False)
def load_historico(self):
if not hasattr(self.review, 'historico'):
self.review.historico = pd.read_csv(self.review.uploads_path() + 'historico.csv')
......
......@@ -8,7 +8,7 @@
<div class="col-md-8">
<img class="report-chart" src="{% url 'data:materias:image' 'mais_reprovacoes.svg'%}">
<img class="report-chart" src="{% url 'data:image' 'mais_reprovacoes.svg'%}">
</div>
<div class="col-md-4">
......@@ -21,11 +21,11 @@
</tr>
</thead>
<tbody>
{% for mat in mat_rep %}
{% for _, mat in mat_rep.iterrows %}
<tr>
<td>{{ mat.code }}</td>
<td>{{ mat.short_name|upper }}</td>
<td>{{ mat.data.p_reprovado|floatformat:2 }}%</td>
<td>{{ mat.COD_ATIV_CURRIC }}</td>
<td>{{ mat.NOME_ATIV_CURRIC|upper }}</td>
<td>{{ mat.p_reprovado|floatformat:2 }}%</td>
</tr>
{% endfor %}
</tbody>
......
......@@ -9,4 +9,6 @@ urlpatterns = patterns('',
url(r'^upload/$', views.upload_database, name='upload_database'),
url(r'^handle_upload/$', views.handle_upload_databases, name='handle_upload'),
url(r'^upload_necessary/$', views.course_dont_have_analisys, name='course_dont_have_analisys'),
url(r'^imagem/(?P<image_path>\w+[.]\w+)$', views.image, name='image'),
)
......@@ -3,7 +3,7 @@
from django.core.urlresolvers import reverse
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect
from django.http import HttpResponseRedirect, HttpResponse
from django.views.decorators.http import require_POST
from .models import forms as forms
......@@ -63,3 +63,17 @@ def handle_upload_databases(request):
return HttpResponseRedirect(reverse('data:validate'))
@login_required
def image(request, image_path):
review = request.session['course'].get_current_review()
image = open(review.results_path() + 'images/' + image_path)
response = HttpResponse(content_type="image/svg+xml")
response.write(image.read())
return response
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment