Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
fc2125b
un cambio en el README
jumaro3112 Nov 16, 2020
1a8a504
Update .travis.yml
jumaro3112 Dec 29, 2020
223d46e
Vers inicial despliegue travis y heroku
jumaro3112 Dec 29, 2020
37c11ac
Update .travis.yml
jumaro3112 Dec 29, 2020
30773a1
Update .travis.yml
jumaro3112 Dec 29, 2020
5b1cada
FUNCIONALIDAD AÑADIDA: Generación automática de código QR
ismaelmelgar Jan 6, 2021
9edbe0d
Añadiendo gráfica de google charts
moi97 Jan 7, 2021
9fec2b8
botones de facebook y twitter
AlvaroAg1995 Jan 7, 2021
e2b7b7f
Merge pull request #1 from jumaro3112/grafica
jumaro3112 Jan 7, 2021
10a7107
Merge pull request #2 from jumaro3112/botonesCompartir
jumaro3112 Jan 7, 2021
3057c5f
Merge pull request #3 from jumaro3112/develop
jumaro3112 Jan 7, 2021
26d2b55
Titulo:Correccion
moi97 Jan 12, 2021
d646c0f
Titulo: Heroku
jumaro3112 Jan 13, 2021
b2b5a5b
Titulo: Cambio
jumaro3112 Jan 14, 2021
95faf6d
Merge pull request #4 from jumaro3112/jumaro3112-travis
jumaro3112 Jan 14, 2021
76a62a9
Merge pull request #5 from jumaro3112/develop
jumaro3112 Jan 14, 2021
253d6e3
Titulo: correccion
jumaro3112 Jan 14, 2021
737df3d
Titulo: Correccion
jumaro3112 Jan 14, 2021
9da0e48
Titulo: Correccion
jumaro3112 Jan 14, 2021
7c954c9
Titulo: Añadido
jumaro3112 Jan 14, 2021
24a6b73
Titulo:Cambio yml
moi97 Jan 14, 2021
f959433
Titulo:travis cambio yml
moi97 Jan 14, 2021
b0c6d03
Titulo:Cambio yml
moi97 Jan 14, 2021
39415a6
Titulo: Script
jumaro3112 Jan 15, 2021
a3fe4dc
Titulo:Prueba
moi97 Jan 15, 2021
fdd9eab
Titulo: TestFuncionalidad3
AlvaroAg1995 Jan 15, 2021
7ea5755
CSS - Cambios en el CSS de Visualizer
josgonman Jan 16, 2021
57a868a
CSS - Cambiando el CSS para cada estado de la votación
josgonman Jan 16, 2021
3a17344
TEST - Prueba para funcionalidad 4 (Generación QR)
ismaelmelgar Jan 16, 2021
a6d5868
Merge pull request #31 from jumaro3112/AlvaroAg1995-Funcionalidad3
jumaro3112 Jan 17, 2021
eb985a3
Merge pull request #32 from jumaro3112/ismaelmelgar-PruebaSeleniumFun…
jumaro3112 Jan 17, 2021
e1da3ad
Merge pull request #33 from jumaro3112/josgonmnman-cssVisualizer
jumaro3112 Jan 17, 2021
70a2e42
Merge pull request #34 from jumaro3112/moi97-PruebaSeleniumFuncionali…
jumaro3112 Jan 17, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 29 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,37 @@
dist: xenial

services:
- postgresql
- postgresql
addons:
postgresql: "9.4"
postgresql: '9.4'
branches:
only:
- master
before_script:
- psql -U postgres -c "create user decide password 'decide'"
- psql -U postgres -c "create database test_decide owner decide"
- psql -U postgres -c "ALTER USER decide CREATEDB"
- psql -U postgres -c "create user decide password 'decide'"
- psql -U postgres -c "create database test_decide owner decide"
- psql -U postgres -c "ALTER USER decide CREATEDB"
language: python
python:
- "3.6"
- '3.6'
install:
- pip install -r requirements.txt
- pip install codacy-coverage
- pip install -r requirements.txt
- pip install codacy-coverage
script:
- cd decide
- coverage run --branch --source=. ./manage.py test --keepdb --with-xunit
- coverage xml
- python-codacy-coverage -r coverage.xml
- cd decide
- cp travis_local_settings.py local_settings.py
- coverage run --branch --source=. ./manage.py test authentication visualizer voting
--keepdb
- coverage xml
- python-codacy-coverage -r coverage.xml
notifications:
email:
recipients:
- moimarram@alum.us.es
on_success: always
on_failure: always
deploy:
provider: heroku
app: egc-guadalquivir-vis
strategy: git
api_key:
secure: lwACeWnAlexzrSMQpw0PRxh+n+JS3vyB1RT5kF7nuEdYfmBCyNqACiqFkSu741RHFei3xmSs4pDgx8qxdnj7ortk94Nh3b1PNquAy5h/Y7c/2GjhJVQtFWcDmAEFYCNOkt6J6OPCmjyS7akLON1XWt9jBE9Dmpwbg9idVwXfcPkFEqQsEZ6Bd1q27d2A6pAd6i+8zCXxixf2ORs6+J3Z5PG7TWNgM6ZlAYiDjRLVfHNcy3/uVzjfM0tdLp6na9cjN4NFd+8Ag/40w02okDHlapdWdTXk3gncqNg2Bcc9O4T4upe1wps++34V7OWy7wYldbN+OhIdlXccY078m7FNQMwG5at/Qw/UV2J7yhJ18TfBL2hh6AEMkEAm6sSn/EwbwKGSiFLBQ96hrkX8N6fARA45bUI8MrE3bCiIDxKRVcSvPBlW9Z1DWcaYnOFWUcZEac4tnVJgp4MikSEwGlD1A59xx9ADwM9w3Ww9plDm8vUgiQN6OGjys+olV1JN+Dd1dCj36vGuL/h7413v2barfbvetS5zH7ZE2O0cxML99hGwt96jo+IhwPoBODGmPAIdMFhNzmHczqGiwGk9vU20N8K+INNRRcyP2B/OPUBgVa43HHQR8xm0ljAL0Lst14rWRXm0uCSwAGg24JTjNVVW6k5s9dUd6jYTxm0s2mBhQuw=
4 changes: 4 additions & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
% prepara el repositorio para su despliegue.
release: sh -c 'cd decide && python manage.py migrate'
% especifica el comando para lanzar Decide
web: sh -c 'cd decide && gunicorn decide.wsgi --log-file -'
Empty file added decide/decide/settings
Empty file.
7 changes: 7 additions & 0 deletions decide/decide/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,14 @@
# number of bits for the key, all auths should use the same number of bits
KEYBITS = 256

APIS = {}

# Versioning
ALLOWED_VERSIONS = ['v1', 'v2']
DEFAULT_VERSION = 'v1'

BASEURL = "https://egc-guadalquivir-vis.herokuapp.com"

try:
from local_settings import *
except ImportError:
Expand All @@ -180,3 +184,6 @@


INSTALLED_APPS = INSTALLED_APPS + MODULES

import django_heroku
django_heroku.settings(locals())
Binary file added decide/geckodriver
Binary file not shown.
Binary file added decide/geckodriver-v0.27.0-linux64.tar.gz
Binary file not shown.
Binary file added decide/geckodriver-v0.27.0-linux64.tar.gz.1
Binary file not shown.
26 changes: 26 additions & 0 deletions decide/testFace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Selenium IDE
import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

class TestFacebook():
def setup_method(self, method):
self.driver = webdriver.Chrome()
self.vars = {}

def teardown_method(self, method):
self.driver.quit()

def test_facebook(self):
self.driver.get("https://egc-guadalquivir-vis.herokuapp.com/visualizer/2/")
self.driver.set_window_size(1298, 863)
self.driver.find_element(By.CSS_SELECTOR, "a:nth-child(1) > img").click()
assert self.driver.find_element(By.ID, "homelink").text == "Facebook"

26 changes: 26 additions & 0 deletions decide/testFace2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Selenium IDE
import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

class TestTestFAceboooooooooooooooook2():
def setup_method(self, method):
self.driver = webdriver.Chrome()
self.vars = {}

def teardown_method(self, method):
self.driver.quit()

def test_testFAceboooooooooooooooook2(self):
self.driver.get("https://egc-guadalquivir-vis.herokuapp.com/visualizer/2/")
self.driver.set_window_size(1298, 863)
self.driver.find_element(By.CSS_SELECTOR, "a:nth-child(1) > img").click()
assert self.driver.find_element(By.CSS_SELECTOR, ".\\_51m-:nth-child(2)").text == "Compartir en Facebook"

Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@
]

APIS = {
'authentication': 'http://10.5.0.1:8000',
'base': 'http://10.5.0.1:8000',
'booth': 'http://10.5.0.1:8000',
'census': 'http://10.5.0.1:8000',
'mixnet': 'http://10.5.0.1:8000',
'postproc': 'http://10.5.0.1:8000',
'store': 'http://10.5.0.1:8000',
'visualizer': 'http://10.5.0.1:8000',
'voting': 'http://10.5.0.1:8000',
'authentication': 'http://localhost:8000',
'base': 'http://localhost:8000',
'booth': 'http://localhost:8000',
'census': 'http://localhost:8000',
'mixnet': 'http://localhost:8000',
'postproc': 'http://localhost:8000',
'store': 'http://localhost:8000',
'visualizer': 'http://localhost:8000',
'voting': 'http://localhost:8000',
}

BASEURL = 'http://10.5.0.1:8000'
BASEURL = 'http://localhost:8000'

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'postgres',
'USER': 'postgres',
'HOST': 'db',
'HOST': 'localhost',
'PORT': '5432',
}
}
Expand Down
173 changes: 165 additions & 8 deletions decide/visualizer/templates/visualizer/visualizer.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,145 @@
href="https://unpkg.com/bootstrap/dist/css/bootstrap.min.css" />
<link type="text/css" rel="stylesheet"
href="https://unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.css" />
<link type="text/css" rel="stylesheet" href="{% static "booth/style.css" %}" />
<link type="text/css" rel="stylesheet" href="{% static "booth/ " %}" />
<!--Load the AJAX API-->
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">

// Load the Visualization API and the corechart package.
google.charts.load('current', {'packages':['corechart']});

// Set a callback to run when the Google Visualization API is loaded.
google.charts.setOnLoadCallback(drawChart);

// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawChart() {

// Create the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');


myObj2 = JSON.parse(JSON.stringify(voting.postproc));
for (var opt in myObj2) {
data.addRows([[myObj2[opt].option,myObj2[opt].postproc]]);
}


// Set chart options

var options = {'title':voting.question.desc,
'width':500,
'height':600};

// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
{% endblock %}

{% block content %}
<style type="text/css">
.bg-secondary{
background-color: #0d4577 !important;
}
.navbar-dark .navbar-brand{
color: rgb(255, 255, 255);
font-weight: bolder;
}
.titulo-votacion{
text-align: center;
font-weight: bolder;
padding-top: 2%;
}
.pregunta-votacion{
text-align: center;
font-weight: bolder;
}
.voting .container{
border-right-style: solid;
border-right-width: 0px;
padding-right: 5%;
padding-left: 5%;
margin-bottom: 20px;
margin-right: 40px;
}
.container{
max-width: 95%;
}
.heading {
font-size: 24px;
font-weight: bold;
}
thead{
color: white !important;
background-color: #0d4577 !important;
text-align: center !important;
}

.column{
float: left;
width: 50%;
border-style: ridge;
border-color: #a8a8a863;
border-width: thin;
}

#qr-result{
font-weight: bolder;
}
.redes{
text-align: center;
font-weight: bolder;
padding-top: 2%;
}
.rrss {
text-align: center;
padding-top: 4%;
padding-bottom: 4%;
}
.sin-empezar{
text-align: center;
padding-top: 4%;
font-weight: bolder;
}

.en_curso{
text-align: center;
padding-top: 4%;
font-weight: bolder;
}

.procesandose{
text-align: center;
padding-top: 4%;
font-weight: bolder;
}

</style>


<div id="app-visualizer">

<!-- Navbar -->
<b-navbar type="dark" variant="secondary">
<b-navbar-brand tag="h1">Decide</b-navbar-brand>
</b-navbar>


<div class="voting container">
<h1>[[ voting.id ]] - [[ voting.name ]]</h1>

<h2 v-if="!voting.start_date">Votación no comenzada</h2>
<h2 v-else-if="!voting.end_date">Votación en curso</h2>
<h1 class="titulo-votacion">[[ voting.name ]]</h1>
<h1 class="pregunta-votacion">[[voting.question.desc]]</h1>
<hr color="black" size=200>
<h2 v-if="!voting.start_date" class="sin-empezar">La votación no ha comenzado aún</h2>
<h2 v-else-if="!voting.end_date" class="en_curso">La votación está en curso</h2>
<h2 v-else-if="!voting.tally" class="procesandose">La votación se encuentra terminada y se están procesando los votos</h2>
<div v-else>
<h2 class="heading">Resultados:</h2>
<h2 class="heading">Resultados de la votación:</h2>

<table class="table table-bordered table-striped">
<thead>
Expand All @@ -40,8 +162,27 @@ <h2 class="heading">Resultados:</h2>
</tr>
</tbody>
</table>
<hr color="black" size=200>
<div class="row">
<div class="column">
<div v-if="voting.end_date" id="chart_div" style="padding-left: 22%;"></div>
</div>
<div class="column" style="padding-top: 4.1%;">
<p v-if="voting.end_date" id="qr-result" style="text-align:center; text-">Puedes compartir los resultados de está votación mediante el siguiente código QR:</p>
<canvas v-if="voting.end_date" id="qr-code" style="padding-left: 45%; padding-bottom:4%"></canvas>
<hr>
<p class="redes">¡También puedes compartir los resultados en las redes sociales!</p>
<p class="rrss">
<a href="javascript:var dir=window.document.URL;var tit=window.document.title;var tit2=encodeURIComponent(tit);var dir2= encodeURIComponent(dir);window.location.href=('http://www.facebook.com/share.php?u='+dir2);"><img src="https://i2.wp.com/www.alexborras.com/wp-content/uploads/2011/04/facebook-logo.png?resize=256%2C256" border="0" width="75" height="75" alt="Compartir" /></a>
&nbsp;&nbsp;&nbsp;
<a href="javascript:var dir=window.document.URL;var tit=window.document.title;var tit2=encodeURIComponent(tit);window.location.href=('http://twitter.com/?status='+'%20'+dir+'');"><img src="https://norfipc.com/img/icon/share-twitter.png" border="0" width="100" height="30" alt="Compartir" /></a>
</p>
<hr>
</div>
</div>

</div>

</div>
</div>
{% endblock %}
Expand All @@ -51,16 +192,32 @@ <h2 class="heading">Resultados:</h2>
<script src="https://unpkg.com/vue"></script>
<script src="https://unpkg.com/babel-polyfill@latest/dist/polyfill.min.js"></script>
<script src="https://unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrious/4.0.2/qrious.min.js"></script>

<script>
var voting = {{voting|safe}};

var app = new Vue({
delimiters: ['[[', ']]'],
el: '#app-visualizer',
data: {
voting: voting
}
})


</script>
</body>

<script>
var qr;
(function() {
qr = new QRious({
element: document.getElementById('qr-code'),
size: 100,
value: window.location.href
});
})();
</script>


{% endblock %}
Loading