Skip to content

Commit

Permalink
gauge iniciativas
Browse files Browse the repository at this point in the history
  • Loading branch information
aniversarioperu committed Oct 25, 2014
1 parent f961911 commit db0d60d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
21 changes: 19 additions & 2 deletions proyectos_de_ley/stats/templates/stats/index.html
Expand Up @@ -6,6 +6,13 @@


{% block additional_css %}
<style>
#g1, #g2 {
width:100px; height:80px;
display: inline-block;
margin: 1em;
}
</style>
{% endblock %}


Expand All @@ -25,7 +32,8 @@ <h3>Número total de proyectos de ley:
<div id="contenido" class="container">
<div class="container">

<div id="without_pdf_url" style="width:200px; height:160px"></div>
<div id="g1" style="width:200px; height:160px"></div>
<div id="g2" style="width:200px; height:160px"></div>

</div><!-- container -->
</div>
Expand All @@ -40,12 +48,21 @@ <h3>Número total de proyectos de ley:

<script>
var g = new JustGage({
id: "without_pdf_url",
id: "g1",
value: {{ percentage_without_pdf_url }},
label: "{{ without_pdf_url }} proyectos",
min: 0,
max: 100,
title: "% sin PDF link"
});

var g = new JustGage({
id: "g2",
value: {{ percentage_without_iniciativas }},
label: "{{ without_iniciativas }} proyectos",
min: 0,
max: 100,
title: "% sin iniciativas\n agrupadas"
});
</script>
{% endblock additional_javascript %}
14 changes: 12 additions & 2 deletions proyectos_de_ley/stats/views.py
Expand Up @@ -7,9 +7,19 @@ def index(request):
numero_de_proyectos = Proyecto.objects.all().count()

without_pdf_url = Proyecto.objects.filter(pdf_url='').count()
percentage_withouth_pdf_url = round(without_pdf_url/numero_de_proyectos, 2)
percentage_without_pdf_url = round(without_pdf_url/numero_de_proyectos, 2)

without_iniciativas = Proyecto.objects.filter(
iniciativas_agrupadas='').count()
percentage_without_iniciativas = round(
without_iniciativas/numero_de_proyectos, 2)

return render(request, "stats/index.html",
{'numero_de_proyectos': numero_de_proyectos,
'without_pdf_url': without_pdf_url,
'percentage_without_pdf_url': percentage_withouth_pdf_url})
'percentage_without_pdf_url': percentage_without_pdf_url,
'without_iniciativas': without_iniciativas,
'percentage_without_iniciativas':
percentage_without_iniciativas,
}
)

0 comments on commit db0d60d

Please sign in to comment.