uclouvain/osis-dissertation

View on GitHub
templates/manager_informations_detail_stats.html

Summary

Maintainability
Test Coverage
{% extends "layout.html" %}
{% load static %}
{% load i18n %}

{% comment "License" %}
 * OSIS stands for Open Student Information System. It's an application
 * designed to manage the core business of higher education institutions,
 * such as universities, faculties, institutes and professional schools.
 * The core business involves the administration of students, teachers,
 * courses, programs and so on.
 *
 * Copyright (C) 2015-2019 Université catholique de Louvain (http://www.uclouvain.be)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * A copy of this license - GNU General Public License - is available
 * at the root of the source code of this program.  If not,
 * see http://www.gnu.org/licenses/.
{% endcomment %}

{% block breadcrumb %}
    <li><a href="{% url 'studies' %}" id="lnk_studies">{% trans "Students' path" %}</a></li>
    <li id="lnk_cohorts_management"><a href="{% url 'cohorts_management' %}">{% trans "Cohorts management" %}</a></li>
    <li><a href="{% url 'dissertations' %}" id="lnk_dissertations">{% trans 'Dissertations' %}</a></li>
    <li><a href="{% url 'manager_informations' %}" id="lnk_teachers">{% trans 'Teachers' %}</a></li>
    <li class="active">{{ adviser.person.last_name }}, {{ adviser.person.first_name }}</li>
{% endblock %}

{% block content %}

  <div class="page-header">
    <h2>{{ adviser.person.last_name }}, {{ adviser.person.first_name }}</h2>
  </div>
  <ul class="nav nav-tabs">
    <li><a href="{% url 'manager_informations_detail' pk=adviser.pk %}">{% trans 'Teacher profile' %}</a></li>
    <li><a href="{% url 'manager_informations_detail_list' pk=adviser.pk %}">{% trans 'Linked dissertations' %}</a></li>
    <li><a href="{% url 'manager_informations_detail_list_wait' pk=adviser.pk %}">{% trans 'Waiting dissertations' %}</a></li>
    <li class="active"><a href="#">{% trans 'Teacher stats' %}</a></li>
  </ul>
  <div class="panel panel-default">
    <div class="panel-body">
      <div class="row">
          <div class="col-md-12">
              <div class="panel panel-default">
                  <div class="panel-heading">
                    <h3 class="panel-title">{% trans 'Stats' %}</h3>
                  </div>
                  <div class="panel-body">
                      <div class="row">
                        <div class="col-md-6" style="text-align: right">
                            <label>{% trans 'Dissertations quantity needing answer' %}</label>
                        </div>
                        <div class="col-md-6">
                            {% if count_advisers_pro_request > 0 %}
                                <span style="color: red"></span>
                            {% else %}
                                <span>
                            {% endif %}
                            {{ count_advisers_pro_request }}
                                </span>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-6" style="text-align: right">
                            <label>{% trans 'Dissertations quantity as promotor' %}</label>
                        </div>
                        <div class="col-md-6">
                            {{ count_advisers_pro }}
                            {% for key,value in tab_offer_count.items %}
                                <br>
                                {% trans 'In this program' %}{{ key }} : {{ value }}
                            {% endfor %}
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-6" style="text-align: right">
                            <label>{% trans 'Dissertations quantity as copromotor' %}</label>
                        </div>
                        <div class="col-md-6">
                            {{ count_advisers_copro }}
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-6" style="text-align: right">
                            <label>{% trans 'Dissertations quantity as reader' %}</label>
                        </div>
                        <div class="col-md-6">
                            {{ count_advisers_reader }}
                        </div>
                    </div>
                    <br>
                    <div class="row">
                        <div class="col-md-4">
                          <h4 class="panel-title">{% trans 'Chart as promotor'  %}</h4>
                          {% if count_advisers_pro > 0 %}
                              <canvas id="pie_chart_pro" width="100" height="100"></canvas>
                          {% else %}
                              <label>{% trans 'No data' %}</label>
                          {% endif %}
                        </div>
                        <div class="col-md-4">
                          <h4 class="panel-title">{% trans 'Chart as copromotor'  %}</h4>
                          {% if count_advisers_copro > 0 %}
                          <canvas id="pie_chart_copro" width="100" height="100"></canvas>
                          {% else %}
                              <label>{% trans 'No data' %}</label>
                          {% endif %}
                        </div>
                        <div class="col-md-4">
                          <h4 class="panel-title">{% trans 'Chart as reader'  %}</h4>
                          {% if count_advisers_reader > 0 %}
                          <canvas id="pie_chart_read" width="100" height="100"></canvas>
                          {% else %}
                              <label>{% trans 'No data' %}</label>
                          {% endif %}
                        </div>
                      </div>
                      <div class="row">

                          </div>
                  </div>
                  </div>
              </div>
          </div>
      </div>
    </div>
{% endblock %}
    {% block script %}
    <script src="/static/js/chart.min.js"></script>
    <script>
    $(function(){
        var ctx_pie_chart_pro = document.getElementById("pie_chart_pro");
        var ctx_pie_chart_copro = document.getElementById("pie_chart_copro");
        var ctx_pie_chart_read = document.getElementById("pie_chart_read");


        var pie_chart_pro = new Chart(ctx_pie_chart_pro, {
            type: 'pie',
            data:
            {
                labels: [
                  {% for key,value in tab_offer_count_pro.items%}
                  "{{key}}",
                  {% endfor %}
                ],

                datasets: [{
                    label: '#',
                    data: [ {% for key,value in tab_offer_count_pro.items%}
                            {{value}},
                            {% endfor %}],
                    backgroundColor: [
                        'rgba(5, 99, 132, 30)',
                        'rgba(54, 162, 235, 30)',
                        'rgba(255, 206, 86, 30)',
                        'rgba(75, 192, 192, 30)',
                        'rgba(153, 102, 255, 30)',
                        'rgba(255, 159, 64, 30)',
                        'rgba(255, 119, 74, 30)',
                        'rgba(175, 192, 192, 30)',
                        'rgba(203, 102, 255, 30)',
                        'rgba(195, 199, 164, 30)',
                        'rgba(255, 229, 174, 30)'
                    ],
                    borderColor: [

                    ],
                    borderWidth: 0
                }]
            },
            options: {
                title: {
                    display: true,
                    options: '{% trans 'Chart as promotor'  %}'
                        }
                      }
        });
        var pie_chart_copro = new Chart(ctx_pie_chart_copro, {
            type: 'pie',
            data: {
                labels: [
                  {% for key,value in tab_offer_count_copro.items%}
                  "{{key}}",
                  {% endfor %}
                ],

                datasets: [{
                    label: '# ',
                    data: [ {% for key,value in tab_offer_count_copro.items%}
                            {{value}},
                            {% endfor %}],
                    backgroundColor: [
                        'rgba(5, 99, 132, 30)',
                        'rgba(54, 162, 235, 30)',
                        'rgba(255, 206, 86, 30)',
                        'rgba(75, 192, 192, 30)',
                        'rgba(153, 102, 255, 30)',
                        'rgba(255, 159, 64, 30)',
                        'rgba(255, 119, 74, 30)',
                        'rgba(175, 192, 192, 30)',
                        'rgba(203, 102, 255, 30)',
                        'rgba(195, 199, 164, 30)',
                        'rgba(255, 229, 174, 30)'
                    ],
                    borderColor: [

                    ],
                    borderWidth: 0
                }]
            },
            options: {
                title: {
                    display: true,
                    options: '{% trans 'Chart as promotor'  %}'
                        }
                      }

        });
        var pie_chart_read = new Chart(ctx_pie_chart_read, {
            type: 'pie',
            data:
            {
                labels: [
                  {% for key,value in tab_offer_count_read.items%}
                  "{{key}}",
                  {% endfor %}
                ],

                datasets: [{
                    label: '#',
                    data: [ {% for key,value in tab_offer_count_read.items%}
                            {{value}},
                            {% endfor %}],
                    backgroundColor: [
                        'rgba(5, 99, 132, 30)',
                        'rgba(54, 162, 235, 30)',
                        'rgba(255, 206, 86, 30)',
                        'rgba(75, 192, 192, 30)',
                        'rgba(153, 102, 255, 30)',
                        'rgba(255, 159, 64, 30)',
                        'rgba(255, 119, 74, 30)',
                        'rgba(175, 192, 192, 30)',
                        'rgba(203, 102, 255, 30)',
                        'rgba(195, 199, 164, 30)',
                        'rgba(255, 229, 174, 30)'
                    ],
                    borderColor: [

                    ],
                    borderWidth: 0
                }]
            },
            options: {
                title: {
                    display: true,
                    options: '{% trans 'Chart as reader'  %}'
                        }
                      }
        });
    });

</script>

{% endblock %}