Skip to content

Commit

Permalink
fix: fix object ID creation for reward group ID
Browse files Browse the repository at this point in the history
  • Loading branch information
fantinodavide committed Sep 6, 2023
1 parent 713c7fd commit 4dd2580
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2817,8 +2817,18 @@ async function init() {
const st = await dbo.collection('configs').findOne({ category: 'seeding_tracker' })
const stConf = st.config;
const requiredPoints = stConf.reward_needed_time.value * (stConf.reward_needed_time.option / 1000 / 60)
const reward_group = st.config.reward_group_id ? (await dbo.collection('groups').findOne({ _id: ObjectID(st.config.reward_group_id) })) : null
console.log('CREATING objIdRewardGroup from value:', st.config.reward_group_id)
let objIdRewardGroup;// = ObjectID(st.config.reward_group_id)
try {
objIdRewardGroup = ObjectID(st.config.reward_group_id)
} catch (error) {
objIdRewardGroup = null;
console.log('FAILED TO CREATE objIdRewardGroup from value:', st.config.reward_group_id, "\n", stConf)
}
let playerGroups = [];
let reward_group;
if (objIdRewardGroup)
reward_group = st.config.reward_group_id ? (await dbo.collection('groups').findOne({ _id: objIdRewardGroup })) : null
// GROUP FORMAT: { name: "groupName", expiration: new Date() }
playerGroups.push(...(await dbo.collection('whitelists').find({ steamid64: steamid64 }).toArray()).map(_e => {
const g = allGroups.find(_g => _g._id.toString() == _e.id_group.toString());
Expand Down Expand Up @@ -3129,7 +3139,8 @@ async function init() {
players: [
'discord_user_id',
'steamid64',
'seeding_points'
'seeding_points',
'discord_roles_ids'
],
sessions: [
'token'
Expand Down

0 comments on commit 4dd2580

Please sign in to comment.