mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
Guild A/B test and Achievement (#8740)
* WIP(guilds): AB test pester modal * WIP(AB-test): guild pester cont'd * fix(style): linting error * fix(AB-test): markModified and notif enum * fix(tests): update AB expectations * fix(modal): remove extra includes * feat(achievements): add Joined Guild cheevo Also removes unused achievement sprites, and properly saves counter used in A/B testing * fix(style): linting error from conflict
This commit is contained in:
@@ -10,7 +10,7 @@ import schema from './schema';
|
||||
schema.plugin(baseModel, {
|
||||
// noSet is not used as updating uses a whitelist and creating only accepts specific params (password, email, username, ...)
|
||||
noSet: [],
|
||||
private: ['auth.local.hashed_password', 'auth.local.passwordHashMethod', 'auth.local.salt', '_cronSignature', '_ABtest', '_ABtests'],
|
||||
private: ['auth.local.hashed_password', 'auth.local.passwordHashMethod', 'auth.local.salt', '_cronSignature', '_ABtests'],
|
||||
toJSONTransform: function userToJSON (plainObj, originalDoc) {
|
||||
plainObj._tmp = originalDoc._tmp; // be sure to send down drop notifs
|
||||
delete plainObj.filters;
|
||||
@@ -94,13 +94,25 @@ function _setUpNewUser (user) {
|
||||
let taskTypes;
|
||||
let iterableFlags = user.flags.toObject();
|
||||
|
||||
user._ABtest = '';
|
||||
// A/B test 2016-12-21: Should we deliver notifications for upcoming incentives on days when users don't receive rewards?
|
||||
if (Math.random() < 0.5) {
|
||||
user._ABtests.checkInModals = '20161221_noCheckInPreviews'; // no 'preview' check-in modals
|
||||
// A/B test 2017-05-11: Can we encourage people to join Guilds with a pester modal?
|
||||
let testGroup = Math.random();
|
||||
if (testGroup < 0.1) {
|
||||
user._ABtests.guildReminder = '20170511_noGuildReminder'; // control group, don't pester about Guilds
|
||||
user._ABtests.counter = -1;
|
||||
} else if (testGroup < 0.235) {
|
||||
user._ABtests.guildReminder = '20170511_text1timing1'; // first sample text, show after two clicks
|
||||
user._ABtests.counter = 0;
|
||||
} else if (testGroup < 0.46) {
|
||||
user._ABtests.guildReminder = '20170511_text2timing1'; // second sample text, show after two clicks
|
||||
user._ABtests.counter = 0;
|
||||
} else if (testGroup < 0.685) {
|
||||
user._ABtests.guildReminder = '20170511_text1timing2'; // first sample text, show after five clicks
|
||||
user._ABtests.counter = 0;
|
||||
} else {
|
||||
user._ABtests.checkInModals = '20161221_showCheckInPreviews'; // show 'preview' check-in modals
|
||||
user._ABtests.guildReminder = '20170511_text2timing2'; // second sample text, show after five clicks
|
||||
user._ABtests.counter = 0;
|
||||
}
|
||||
|
||||
user.items.quests.dustbunnies = 1;
|
||||
user.purchased.background.violet = true;
|
||||
user.preferences.background = 'violet';
|
||||
|
||||
Reference in New Issue
Block a user