mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
Mixed type field for A/B testing (#8302)
* feat(AB-testing): mixed type field
* fix(AB-testing): lint errors
* fix(AB-testing): allow client access to _ABtests
* Revert "fix(AB-testing): allow client access to _ABtests"
This reverts commit 25832365ba.
* fix(AB-testing): preview check on server
* refactor(AB-testing): add comments
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.salt', '_cronSignature', '_ABtest'],
|
||||
private: ['auth.local.hashed_password', 'auth.local.salt', '_cronSignature', '_ABtest', '_ABtests'],
|
||||
toJSONTransform: function userToJSON (plainObj, originalDoc) {
|
||||
plainObj._tmp = originalDoc._tmp; // be sure to send down drop notifs
|
||||
delete plainObj.filters;
|
||||
@@ -78,6 +78,12 @@ function _setUpNewUser (user) {
|
||||
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
|
||||
} else {
|
||||
user._ABtests.checkInModals = '20161221_showCheckInPreviews'; // show 'preview' check-in modals
|
||||
}
|
||||
user.items.quests.dustbunnies = 1;
|
||||
|
||||
if (user.registeredThrough === 'habitica-web' || user.registeredThrough === 'habitica-android') {
|
||||
|
||||
Reference in New Issue
Block a user