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

View file

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