Repo Cleanup
This commit is contained in:
@@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
"db_name": "SQLite",
|
|
||||||
"query": "SELECT id name FROM players",
|
|
||||||
"describe": {
|
|
||||||
"columns": [
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"ordinal": 0,
|
|
||||||
"type_info": "Integer"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"parameters": {
|
|
||||||
"Right": 0
|
|
||||||
},
|
|
||||||
"nullable": [
|
|
||||||
false
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"hash": "630981b7637ee724554aa5a4ad1f49453766684f9cdf724178c9320a12a56bac"
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
create table if not exists players
|
|
||||||
(
|
|
||||||
id integer primary key not null,
|
|
||||||
name text not null
|
|
||||||
)
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
create table if not exists votes
|
|
||||||
(
|
|
||||||
id integer primary key not null,
|
|
||||||
timestamp date not null,
|
|
||||||
plus_id integer not null,
|
|
||||||
plus_nickname text not null,
|
|
||||||
plus_reason text not null,
|
|
||||||
moins_id integer not null,
|
|
||||||
moins_nickname text not null,
|
|
||||||
moins_reason text not null
|
|
||||||
)
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
-- Add migration script here
|
|
||||||
drop table if exists votes
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
create table if not exists votes
|
|
||||||
(
|
|
||||||
id integer primary key not null,
|
|
||||||
timestamp text not null,
|
|
||||||
plus_id integer not null,
|
|
||||||
plus_nickname text not null,
|
|
||||||
plus_reason text not null,
|
|
||||||
moins_id integer not null,
|
|
||||||
moins_nickname text not null,
|
|
||||||
moins_reason text not null
|
|
||||||
)
|
|
||||||
@@ -56,13 +56,23 @@ async function load_page(id) {
|
|||||||
let submit = document.createElement("button");
|
let submit = document.createElement("button");
|
||||||
submit.textContent = "A Voté";
|
submit.textContent = "A Voté";
|
||||||
submit.addEventListener("click", async () => {
|
submit.addEventListener("click", async () => {
|
||||||
Vote.vote_moins_id = vote_id_select.value;
|
if (vote.vote_plus_id === null || vote.vote_moins_id === null) {
|
||||||
Vote.vote_moins_nickname = vote_nickname_input.value;
|
const popUp = document.createElement("div");
|
||||||
Vote.vote_moins_reason = vote_reason_input.value;
|
popUp.className = "popup";
|
||||||
if (await send_vote(Vote)) {
|
const message = document.createElement("h2");
|
||||||
confirm_popup();
|
message.textContent = "Tu dois dire pour qui tu vote!";
|
||||||
save_state();
|
const page = document.body;
|
||||||
}
|
popUp.append(message);
|
||||||
|
page.append(popUp);
|
||||||
|
} else {
|
||||||
|
Vote.vote_moins_id = vote_id_select.value;
|
||||||
|
Vote.vote_moins_nickname = vote_nickname_input.value;
|
||||||
|
Vote.vote_moins_reason = vote_reason_input.value;
|
||||||
|
if (await send_vote(Vote)) {
|
||||||
|
confirm_popup();
|
||||||
|
save_state();
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
submit.className = "right";
|
submit.className = "right";
|
||||||
previous.className = "left";
|
previous.className = "left";
|
||||||
@@ -114,9 +124,6 @@ function get_state() {
|
|||||||
return cookie.includes("hasvoted=true");
|
return cookie.includes("hasvoted=true");
|
||||||
}
|
}
|
||||||
async function send_vote(vote) {
|
async function send_vote(vote) {
|
||||||
if (vote.vote_plus_id === null || vote.vote_moins_id === null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
vote.vote_plus_id = parseInt(vote.vote_plus_id, 10);
|
vote.vote_plus_id = parseInt(vote.vote_plus_id, 10);
|
||||||
vote.vote_moins_id = parseInt(vote.vote_moins_id, 10);
|
vote.vote_moins_id = parseInt(vote.vote_moins_id, 10);
|
||||||
let body = JSON.stringify(vote);
|
let body = JSON.stringify(vote);
|
||||||
|
|||||||
Reference in New Issue
Block a user