refactor to use the new db schema
This commit is contained in:
parent
cfb09349c9
commit
79418dcf32
2 changed files with 2 additions and 2 deletions
|
|
@ -6,7 +6,7 @@ export async function countVotes(data: any): Promise<object> {
|
||||||
|
|
||||||
let response = `Quote Votes:`;
|
let response = `Quote Votes:`;
|
||||||
for (var i in db[gID].bracket.quotes) {
|
for (var i in db[gID].bracket.quotes) {
|
||||||
response += `\n${db[gID].bracket.votes[i] ?? 0} votes for \`${db[gID].bracket.quotes[i]}\``;
|
response += `\n${db[gID].bracket.quotes[i].votes} votes for \`${db[gID].bracket.quotes[i]}\``;
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
type: 4,
|
type: 4,
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ export async function deleteVote(data: any): Promise<object> {
|
||||||
|
|
||||||
// Subtract user's vote from total
|
// Subtract user's vote from total
|
||||||
let vote = db[gID].bracket.users[userID];
|
let vote = db[gID].bracket.users[userID];
|
||||||
--db[gID].bracket.votes[vote];
|
--db[gID].bracket.quotes[vote].votes;
|
||||||
|
|
||||||
delete db[gID].bracket.users[userID];
|
delete db[gID].bracket.users[userID];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue