Adventure Guide Prep (#11883)
* WIP(adventure): prereqs * WIP(drops): new modal * WIP(adventure): analytics fixes etc * feat(adventure): random egg+potion on 2nd task * fix(lint): noworkies * fix(modal): correctly construct classes * fix(tests): expectations and escape * fix(first-drops): address comments * fix(first-drops): don't give random drops until first drops * fix(drops): remove more Level 3 references * refactor(drops): no need for cloning * refactor(drops): unnecessary export * fix(first-drops): force sync * fix(first-drops): move to server * fix(first-drops): escape in case we get here with >0 items * fix(lint): line length * fix(pet-food): remove unused string
This commit is contained in:
@@ -797,10 +797,11 @@ api.scoreTask = {
|
||||
|
||||
const wasCompleted = task.completed;
|
||||
|
||||
const [delta] = common.ops.scoreTask({ task, user, direction }, req);
|
||||
const firstTask = !user.achievements.completedTask;
|
||||
const [delta] = common.ops.scoreTask({ task, user, direction }, req, res.analytics);
|
||||
// Drop system (don't run on the client,
|
||||
// as it would only be discarded since ops are sent to the API, not the results)
|
||||
if (direction === 'up') common.fns.randomDrop(user, { task, delta }, req, res.analytics);
|
||||
if (direction === 'up' && !firstTask) common.fns.randomDrop(user, { task, delta }, req, res.analytics);
|
||||
|
||||
// If a todo was completed or uncompleted move it in or out of the user.tasksOrder.todos list
|
||||
// TODO move to common code?
|
||||
@@ -884,7 +885,7 @@ api.scoreTask = {
|
||||
}
|
||||
|
||||
// Track when new users (first 7 days) score tasks
|
||||
if (moment().diff(user.auth.timestamps.created, 'days') < 7) {
|
||||
if (moment().diff(user.auth.timestamps.created, 'days') < 7 && user.flags.welcomed) {
|
||||
res.analytics.track('task score', {
|
||||
uuid: user._id,
|
||||
hitType: 'event',
|
||||
|
||||
@@ -108,7 +108,7 @@ export async function createTasks (req, res, options = {}) {
|
||||
// are the onboarding ones
|
||||
if (!user.achievements.createdTask && user.flags.welcomed) {
|
||||
user.addAchievement('createdTask');
|
||||
shared.onboarding.checkOnboardingStatus(user);
|
||||
shared.onboarding.checkOnboardingStatus(user, res.analytics);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ export default new Schema({
|
||||
reorderTask: { $type: Boolean, default: false },
|
||||
},
|
||||
},
|
||||
dropsEnabled: { $type: Boolean, default: false },
|
||||
dropsEnabled: { $type: Boolean, default: false }, // unused
|
||||
itemsEnabled: { $type: Boolean, default: false },
|
||||
newStuff: { $type: Boolean, default: false },
|
||||
rewrite: { $type: Boolean, default: true },
|
||||
|
||||
@@ -5,7 +5,7 @@ import validator from 'validator';
|
||||
import baseModel from '../libs/baseModel';
|
||||
|
||||
const NOTIFICATION_TYPES = [
|
||||
'DROPS_ENABLED',
|
||||
'DROPS_ENABLED', // unused
|
||||
'REBIRTH_ENABLED',
|
||||
'WON_CHALLENGE',
|
||||
'STREAK_ACHIEVEMENT',
|
||||
@@ -34,6 +34,7 @@ const NOTIFICATION_TYPES = [
|
||||
'NEW_STUFF',
|
||||
'NEW_CHAT_MESSAGE',
|
||||
'LEVELED_UP',
|
||||
'FIRST_DROPS',
|
||||
'ONBOARDING_COMPLETE',
|
||||
'ACHIEVEMENT_ALL_YOUR_BASE',
|
||||
'ACHIEVEMENT_BACK_TO_BASICS',
|
||||
|
||||
Reference in New Issue
Block a user