Conjunto be17cf0 en consulta_publica


Ignorar:
Fecha y hora:
08/06/2017 15:16:01 (hace 7 años)
Autor:
rudmanmrrod <rudman22@…>
Branches:
constituyente, estudiantes, general, plan_patria, sala
Children:
38855e2
Parents:
8edb1df
Mensaje:

Agregado el reporte por sector

Ficheros:
2 añadidos
3 editados

Leyenda

No modificado
Añadido
Eliminado
  • base/constant.py

    r0b2127c rbe17cf0  
    2222## Sectores
    2323SECTORES = (
    24     ('TR','Trabajadores y trabajadoras'),
    25     ('CP','Campesinas, campesinos, pescadoras y pescadores'),
    26     ('ES','Los y las estudiantes del país'),
    27     ('PD','Las personas con alguna discapacidad'),
    28     ('PI','Los pueblos indígenas del país'),
    29     ('PE','Pensionados y pensionadas'),
    30     ('EM','Empresarios y empresarias'),
    31     ('CM','Las comunas y consejos comunales'),   
     24    ('TR','Trabajadores'),
     25    ('CP','Campesinos y pescadores'),
     26    ('ES','Estudiantes'),
     27    ('PD','Personas con alguna discapacidad'),
     28    ('PI','Pueblos indígenas'),
     29    ('PE','Pensionados'),
     30    ('EM','Empresarios'),
     31    ('CM','Comunas y Consejos Comunales'),   
    3232)
    3333
  • consulta/templates/consulta.pdf.template.html

    r8edb1df rbe17cf0  
    3333                <p><b>Objetivo: </b>{{objetivo_texto}}<p>
    3434            </div>
    35             {% if lugar %}
    36                 <table class="table">
    37                     <thead>
    38                         <tr>
    39                             <th>Ubicación</th>
    40                             <th>Participantes</th>
    41                         </tr>
    42                     </thead>
    43                     <tbody class="text-center">
    44                         <tr>
    45                             <td>{{ubicacion}}</td>
    46                             <td>{{lugar}}</td>
    47                         </tr>
    48                     </tbody>
    49                 </table>
     35            {% if lugar > 0 %}
     36                {% include 'consulta.base.table.pdf.html' with title_1='Ubicación' title_2='Participantes' texto=ubicacion valor=lugar %}
    5037            {% endif %}
    5138            {% if estados %}
    52                 <table class="table">
    53                     <caption><h4 class="text-center">Participación por todos los estados</h4></caption>
    54                     <thead>
    55                         <tr>
    56                             <th>Ubicación</th>
    57                             <th>Participantes</th>
    58                         </tr>
    59                     </thead>
    60                     <tbody class="text-center">
    61                         {% for item in estados %}
    62                             <tr>
    63                             {% for value in item%}
    64                                 <td>{{ value }}</td>
    65                             {% endfor %}
    66                             </tr>
    67                         {% endfor %}
    68                     </tbody>
    69                 </table>
     39                {% include 'consulta.base.multi.table.pdf.html' with title_1='Ubicación' title_2='Participantes' texto=sector_trabajador_texto valor=sector_trabajador data=estados caption='Participación por todos los estados' %}
     40            {% endif %}
     41            {% if sector >= 0 %}
     42                {% include 'consulta.base.table.pdf.html' with title_1='Sector' title_2='Participantes' texto=sector_texto valor=sector caption='Participación por sector' %}
     43            {% endif %}
     44            {% if sector_trabajador >= 0 %}
     45                {% include 'consulta.base.table.pdf.html' with title_1='Sector' title_2='Participantes' texto=sector_trabajador_texto valor=sector_trabajador caption='Participación por sector trabajador' %}
     46            {% endif %}
     47            {% if sector_estudiante >= 0 %}
     48                {% include 'consulta.base.table.pdf.html' with title_1='Sector' title_2='Participantes' texto=sector_trabajador_texto valor=sector_trabajador caption='Participación por sector trabajador' %}
     49            {% endif %}
     50            {% if sectores %}
     51                {% include 'consulta.base.multi.table.pdf.html' with title_1='Ubicación' title_2='Participantes' texto=sector_trabajador_texto valor=sector_trabajador data=sectores caption='Participación por todos los sectores' %}
    7052            {% endif %}
    7153            <p class="text-center"><b>Respuestas totales emitidas por Usuario: </b>{{respuestas}}</p>
  • consulta/views.py

    r8edb1df rbe17cf0  
    3131from participacion.models import RespuestaSino, RespuestaOpciones, RespuestaAbierta
    3232from users.models import Perfil
    33 from base.constant import OBJETIVOS
     33from base.constant import OBJETIVOS, SECTORES, SECTOR_ESTUDIANTE, SECTOR_TRABAJADOR
    3434from base.models import Entidad, Municipio, Parroquia
    3535 
     
    440440            kwargs['ubicacion'] = Parroquia.objects.get(pk=parroquia)
    441441        ## Se validan los filtros por sector
    442         if sector!='':
    443             pass
     442        SECTOR = dict(SECTORES)
     443        ST = dict(SECTOR_TRABAJADOR)
     444        SE = dict(SECTOR_ESTUDIANTE)
     445        if sector=='':
     446            datos = []
     447            for sec in SECTOR:
     448                data = Perfil.objects.filter(sector=sec,user_id__in=resp.values_list('user_id',flat=True)).count()
     449                datos.append([SECTOR[sec],data])
     450            kwargs['sectores'] = datos
     451        elif sector == 'TR' and sector_trabajador!='':
     452            sec = Perfil.objects.filter(sector=sector,user_id__in=resp.values_list('user_id',flat=True))
     453            kwargs['sector'] = sec.count()
     454            kwargs['sector_texto'] = SECTOR[sector]
     455            sec = sec.filter(sector_trabajador=sector_trabajador)
     456            kwargs['sector_trabajador'] = sec.count()
     457            kwargs['sector_trabajador_texto'] = ST[sector_trabajador]
     458        elif sector == 'ES' and sector_estudiante!='':
     459            sec = Perfil.objects.filter(sector=sector,user_id__in=resp.values_list('user_id',flat=True))
     460            kwargs['sector'] = sec.count()
     461            kwargs['sector_texto'] = SECTOR[sector]
     462            sec = sec.filter(sector_estudiante=sector_estudiante)
     463            kwargs['sector_estudiante'] = sec.count()
     464            kwargs['sector_estudiante_texto'] = SE[sector_estudiante]
     465        else:
     466            sec = Perfil.objects.filter(sector=sector,user_id__in=resp.values_list('user_id',flat=True))
     467            kwargs['sector'] = sec.count()
     468            kwargs['sector_texto'] = SECTOR[sector]
    444469        kwargs['respuestas'] = resp.count()
    445470        kwargs['pregunta_texto'] = preg
Nota: Vea TracChangeset para ayuda en el uso del visor de conjuntos de cambios.