Browse Source

finished stats page, removed debug messages

pull/10/head
crunch 6 months ago
parent
commit
d77e6475ca
8 changed files with 37 additions and 12 deletions
  1. +1
    -1
      Consulta_project/landing/static/js/stats.js
  2. +2
    -2
      Consulta_project/landing/templates/landing/index_base.html
  3. +8
    -0
      Consulta_project/polls/models.py
  4. +2
    -0
      Consulta_project/polls/templates/admin/guardian/model/change_form.html
  5. +2
    -1
      Consulta_project/polls/templates/admin/polls/poll/submit_line.html
  6. +3
    -1
      Consulta_project/polls/templates/admin/polls/question/submit_line.html
  7. +4
    -4
      Consulta_project/polls/templates/polls/share.html
  8. +15
    -3
      Consulta_project/polls/templates/polls/stats.html

+ 1
- 1
Consulta_project/landing/static/js/stats.js View File

@@ -83,7 +83,7 @@ function createPieChart(series, labels, target_id) {
var ctx = document.getElementById(target_id).getContext('2d');
var chart = new Chart(ctx, {
// The type of chart we want to create
type: 'doughnut',
type: 'pie',

// The data for our dataset
data: {


+ 2
- 2
Consulta_project/landing/templates/landing/index_base.html View File

@@ -27,7 +27,7 @@
{% if request.user.is_staff %}
<li class="nav-item" role="presentation"><a class="nav-link" href="/editor">Poll Editor</a></li>
{% else %}
<li class="nav-item" role="presentation"><a class="nav-link" data-toggle="tooltip"
<li class="nav-item" role="presentation"><a class="nav-link" data-toggle="tooltip" style="color:dimgray"
data-bs-tooltip="" data-placement="bottom"
title="You must be part of staff to create &amp; edit polls.">Poll Editor</a></li>
{% endif %}
@@ -38,7 +38,7 @@
href="{% url 'register' %}">Register</a></li>
{% else %}
<li class="nav-item" role="presentation"><a class="nav-link" href="{% url 'logout' %}">Logout</a></li>
<li class="nav-item" role="presentation"><a class="nav-link">Logged in as user "{{ request.user.username }}"</a></li>
<li class="nav-item" role="presentation"><a class="nav-link">Logged in as "{{ request.user.username }}"</a></li>
{% endif %}
</ul>
</div>


+ 8
- 0
Consulta_project/polls/models.py View File

@@ -65,6 +65,14 @@ class Question(models.Model):
answer_strings.append(answer.answer_string)
return answer_strings

def answers_have_votes(self):
hasVotes = False
for answer in self.get_answers():
if (answer.count > 0):
hasVotes = True

return hasVotes

def get_owner(self):
return self.user



+ 2
- 0
Consulta_project/polls/templates/admin/guardian/model/change_form.html View File

@@ -3,10 +3,12 @@

{% block field_sets %}
{% if change_poll or superuser %}
{% if poll %}
<p style="font-weight: bolder;">Enter these links into the PowerPoint Liveslides Add-In:</p>
<p style="color:darkcyan; font-weight: bold;"><small style="color: black; font-weight: lighter;">Begin URL:</small> {{ begin_url }}</p>
<p style="color:darkcyan; font-weight: bold;"><small style="color: black; font-weight: lighter;">Stats URL:</small> {{ stats_url }}</p>
<p style="color:darkcyan; font-weight: bold;"><small style="color: black; font-weight: lighter;">End URL:</small> {{ end_url }}</p>
{% endif %}
{% endif %}
{% for fieldset in adminform %}
{% include "admin/polls/includes/fieldset.html" %}


+ 2
- 1
Consulta_project/polls/templates/admin/polls/poll/submit_line.html View File

@@ -1,6 +1,7 @@
{% load i18n admin_urls %}
{% load guardian_tags %}

<!-- Debug for Guardian Permissions
{% if add_poll %}
Poll can be added
{% endif %}
@@ -23,7 +24,7 @@ Logged in user is superuser

{% if new %}
This poll was not created yet
{% endif %}
{% endif %} -->

<div class="submit-row">
{% block submit-row %}


+ 3
- 1
Consulta_project/polls/templates/admin/polls/question/submit_line.html View File

@@ -1,6 +1,8 @@
{% load i18n admin_urls %}
{% load guardian_tags %}


<!-- Debug for Guardian Permissions
{% if add_question %}
Question can be added
{% endif %}
@@ -23,7 +25,7 @@ Logged in user is superuser

{% if new %}
This question was not created yet
{% endif %}
{% endif %} -->

<div class="submit-row">
{% block submit-row %}


+ 4
- 4
Consulta_project/polls/templates/polls/share.html View File

@@ -7,17 +7,17 @@
<div class="d-flex justify-content-center align-items-center" style="background-color: rgba(0,0,0,0.1);margin-top: 30px;height: 75vh;font-family: Inter;">
<div class="container" style="padding-bottom: 30px;padding-top: 30px;">
<div class="row d-flex justify-content-center align-items-center">
<div class="col d-flex d-xl-flex justify-content-center justify-content-lg-center justify-content-xl-center">
<div class="col d-flex justify-content-center">
<h1 style="font-family: Inter;">{{ poll.name }}</h1>
</div>
</div>
<div class="row d-flex d-xl-flex justify-content-center align-items-center justify-content-xl-center" style="margin-right: 15vw;margin-left: 15vw;">
<div class="col-12 col-md-8 col-lg-9 col-xl-7">
<div class="media d-flex justify-content-center align-items-center"><img class="mr-3" alt="QR code for {{ poll.name }}" src="{% qr_url_from_text qr %}" style="background-color: white;"></div>
<div class="col">
<div class="media d-flex justify-content-center align-items-center"><img alt="QR code for {{ poll.name }}" src="{% qr_url_from_text qr %}" style="background-color: white;"></div>
</div>
</div>
<div class="row d-flex d-xl-flex justify-content-center align-items-center justify-content-xl-center">
<div class="col-12 col-md-8 col-lg-9 col-xl-7 d-flex justify-content-center align-items-center">
<div class="col d-flex justify-content-center">
<h6 style="margin-top: 8px;"><a href="{% url 'poll-detail' poll.slug %}" style="font-family: Inter;">{{ qr }}</a></h6>
</div>
</div>


+ 15
- 3
Consulta_project/polls/templates/polls/stats.html View File

@@ -18,7 +18,7 @@

{% for question in poll.get_questions %}

{% if question.get_answers %}
{% if question.get_answers and question.answers_have_votes %}

<div class="row" style="margin-top: 15px;margin-bottom: 15px;">
<div class="col d-flex justify-content-center">
@@ -34,15 +34,27 @@
</div>
</div>

{% elif question.get_answers %}
<div class="row" style="margin-top: 15px;margin-bottom: 15px;">
<div class="col d-flex justify-content-center">
<h3>{{ question.question_string }}</h3>
</div>
</div>
<div class="row" style="margin-top: 15px;margin-bottom: 15px;">
<div class="col d-flex justify-content-center">
<h4>The answers to this question have no votes.</h4>
</div>
</div>

{% else %}

<div class="row" style="margin-top: 15px;margin-bottom: 15px;">
<div class="col d-flex d-xl-flex justify-content-center">
<div class="col d-flex justify-content-center">
<h3>{{ question.question_string }}</h3>
</div>
</div>
<div class="row" style="margin-top: 15px;margin-bottom: 15px;">
<div class="col d-flex d-xl-flex justify-content-center justify-content-lg-center justify-content-xl-center">
<div class="col d-flex justify-content-center">
<h4>There are no answers to this question.</h4>
</div>
</div>


Loading…
Cancel
Save