Creating and sending ballot

This commit is contained in:
armored-dragon 2024-09-05 17:06:12 -05:00
parent f62d20908a
commit efc64c6cd7
No known key found for this signature in database
GPG key ID: C7207ACC3382AD8B
2 changed files with 5 additions and 5 deletions

View file

@ -164,13 +164,13 @@
// Cast a vote on a poll
function castVote(event) {
console.log(`Casting vote to ${poll.id}: ${event}`);
console.log(`Casting vote to ${poll.id}`);
// Check if poll is valid
if (poll == undefined || poll.id == '') return;
// Send vote to server
Messages.sendMessage(poll.id, JSON.stringify({type: "vote", option: event.option}));
// Send vote to users in poll
Messages.sendMessage(poll.id, JSON.stringify({type: "vote", ballot: event.ballot, uuid: myUuid}));
}
// Emit the prompt question and options to the server
@ -192,8 +192,7 @@
// Communication
function fromQML(event) {
console.log(`New QML event:\n${JSON.stringify(event)}`);
// event = JSON.parse(event);
console.log(event.type);
switch (event.type) {
case "create_poll":
createPoll(event.poll);

View file

@ -365,6 +365,7 @@ Rectangle {
}
}
// TODO: Keep track of used numbers and blacklist them
// Options
Item {
width: parent.width