quick fix
This commit is contained in:
@@ -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
|
|
||||||
)
|
|
||||||
@@ -60,7 +60,8 @@ async function main() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (await fetch("/post", {
|
if (await fetch("/post", {
|
||||||
method:"post", body: JSON.stringify(vote)})
|
method: "post", body: JSON.stringify(vote)
|
||||||
|
})
|
||||||
.then(r => r.status) === 200) {
|
.then(r => r.status) === 200) {
|
||||||
set_cookie();
|
set_cookie();
|
||||||
showMessage("Merci pour ton vote!", "Ton vote a bien été prit en compte.", false, "info");
|
showMessage("Merci pour ton vote!", "Ton vote a bien été prit en compte.", false, "info");
|
||||||
@@ -93,68 +94,6 @@ async function main() {
|
|||||||
reason.value = vote.plus_reason;
|
reason.value = vote.plus_reason;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
|
|
||||||
if (id) {
|
|
||||||
vote_id_select.value = Vote.vote_moins_id;
|
|
||||||
vote_nickname_input.value = Vote.vote_moins_nickname;
|
|
||||||
vote_reason_input.value = Vote.vote_moins_reason;
|
|
||||||
header.textContent = "Vote -";
|
|
||||||
let previous = document.createElement("button");
|
|
||||||
previous.textContent = "Précédent";
|
|
||||||
previous.addEventListener("click", () => {
|
|
||||||
Vote.vote_moins_id = vote_id_select.value;
|
|
||||||
Vote.vote_moins_nickname = vote_nickname_input.value;
|
|
||||||
Vote.vote_moins_reason = vote_reason_input.value;
|
|
||||||
load_page(0)
|
|
||||||
});
|
|
||||||
let submit = document.createElement("button");
|
|
||||||
submit.textContent = "A Voté";
|
|
||||||
submit.addEventListener("click", async () => {
|
|
||||||
/*if (vote.vote_plus_id === null || vote.vote_moins_id === null) {
|
|
||||||
const popUp = document.createElement("div");
|
|
||||||
popUp.className = "popup";
|
|
||||||
const message = document.createElement("h2");
|
|
||||||
message.textContent = "Tu dois dire pour qui tu vote!";
|
|
||||||
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";
|
|
||||||
previous.className = "left";
|
|
||||||
buttons.append(previous, submit);
|
|
||||||
} else {
|
|
||||||
vote_id_select.value = Vote.vote_plus_id;
|
|
||||||
vote_nickname_input.value = Vote.vote_plus_nickname;
|
|
||||||
vote_reason_input.value = Vote.vote_plus_reason;
|
|
||||||
header.textContent = "Vote +";
|
|
||||||
let next = document.createElement("button");
|
|
||||||
next.innerText = "Suivant";
|
|
||||||
next.addEventListener("click", () => {
|
|
||||||
Vote.vote_plus_id = vote_id_select.value;
|
|
||||||
Vote.vote_plus_nickname = vote_nickname_input.value;
|
|
||||||
Vote.vote_plus_reason = vote_reason_input.value;
|
|
||||||
load_page(1)
|
|
||||||
});
|
|
||||||
next.className = "right";
|
|
||||||
buttons.appendChild(next);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const div = document.getElementById("app");
|
|
||||||
div.innerHTML = "";
|
|
||||||
div.append(header, vote_id, vote_id_select, vote_nickname, vote_nickname_input, vote_reason, vote_reason_input, buttons);
|
|
||||||
>>>>>>> 0f470ef (oui)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showMessage(title, description, canBeDismissed, type) {
|
function showMessage(title, description, canBeDismissed, type) {
|
||||||
|
|||||||
Reference in New Issue
Block a user