From 54528067d7a93e35af8b16f70d5e7efdaf8860ae Mon Sep 17 00:00:00 2001 From: Sendou Date: Mon, 6 Jan 2020 04:30:15 +0200 Subject: [PATCH] membership assignment fix --- graphql-schemas/plus.js | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/graphql-schemas/plus.js b/graphql-schemas/plus.js index ef3e1ff5e..d378aa96b 100644 --- a/graphql-schemas/plus.js +++ b/graphql-schemas/plus.js @@ -561,6 +561,7 @@ const resolvers = { membership_status, can_not_vouch, voucher_discord_id, + dont_update, } = votingArray[discord_id] const same_total = same_region.reduce((acc, cur) => acc + cur) @@ -613,22 +614,19 @@ const resolvers = { ) } else if ( total_score >= 50 && - membership_status !== arrays_plus_server + membership_status !== arrays_plus_server && + !dont_update ) { - if (membership_status === "TWO") - userUpdates.push(() => - User.updateOne( - { discord_id }, - { $set: { "plus.membership_status": "TWO" } } - ) - ) - else - userUpdates.push(() => - User.updateOne( - { discord_id }, - { $set: { "plus.membership_status": "ONE" } } - ) + userUpdates.push(() => + User.updateOne( + { discord_id }, + { $set: { "plus.membership_status": arrays_plus_server } } ) + ) + + if (arrays_plus_server === "ONE" && plus_two_voted[discord_id]) { + plus_two_voted[discord_id].dont_update = true + } } if (voucher_discord_id) {