mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 13:17:24 +01:00
chore(news): Bailey
and tweak today's migrations for new format
This commit is contained in:
@@ -10,7 +10,6 @@ var monk = require('monk');
|
||||
var connectionString = 'mongodb://localhost:27017/habitrpg?auto_reconnect=true'; // FOR TEST DATABASE
|
||||
var dbUsers = monk(connectionString).get('users', { castIds: false });
|
||||
|
||||
|
||||
function processUsers(lastId) {
|
||||
// specify a query to limit the affected users (empty for all users):
|
||||
var query = {
|
||||
@@ -45,10 +44,10 @@ function updateUsers (users) {
|
||||
return;
|
||||
}
|
||||
|
||||
var userPaymentPromises = users.map(updateUser);
|
||||
var userPromises = users.map(updateUser);
|
||||
var lastUser = users[users.length - 1];
|
||||
|
||||
return Promise.all(userPaymentPromises)
|
||||
return Promise.all(userPromises)
|
||||
.then(function () {
|
||||
processUsers(lastUser._id);
|
||||
});
|
||||
|
||||
@@ -6,49 +6,69 @@ var authorUuid = '7f14ed62-5408-4e1b-be83-ada62d504931'; //... own data is done
|
||||
* Remove flag stating that the Enchanted Armoire is empty, for when new equipment is added
|
||||
*/
|
||||
|
||||
var mongo = require('mongoskin');
|
||||
|
||||
var monk = require('monk');
|
||||
var connectionString = 'mongodb://localhost:27017/habitrpg?auto_reconnect=true'; // FOR TEST DATABASE
|
||||
var dbUsers = monk(connectionString).get('users', { castIds: false });
|
||||
|
||||
var dbUsers = mongo.db(connectionString).collection('users');
|
||||
|
||||
function processUsers(lastId) {
|
||||
// specify a query to limit the affected users (empty for all users):
|
||||
var query = {
|
||||
'flags.armoireEmpty':true
|
||||
'flags.armoireEmpty': true,
|
||||
};
|
||||
|
||||
// specify fields we are interested in to limit retrieved data (empty if we're not reading data):
|
||||
var fields = {
|
||||
};
|
||||
if (lastId) {
|
||||
query._id = {
|
||||
$gt: lastId
|
||||
}
|
||||
}
|
||||
|
||||
dbUsers.find(query, {
|
||||
sort: {_id: 1},
|
||||
limit: 250,
|
||||
fields: [] // specify fields we are interested in to limit retrieved data (empty if we're not reading data):
|
||||
})
|
||||
.then(updateUsers)
|
||||
.catch(function (err) {
|
||||
console.log(err);
|
||||
return exiting(1, 'ERROR! ' + err);
|
||||
});
|
||||
}
|
||||
|
||||
console.warn('Updating users...');
|
||||
var progressCount = 1000;
|
||||
var count = 0;
|
||||
dbUsers.findEach(query, fields, {batchSize:250}, function(err, user) {
|
||||
if (err) { return exiting(1, 'ERROR! ' + err); }
|
||||
if (!user) {
|
||||
|
||||
function updateUsers (users) {
|
||||
if (!users || users.length === 0) {
|
||||
console.warn('All appropriate users found and modified.');
|
||||
setTimeout(displayData, 300000);
|
||||
displayData();
|
||||
return;
|
||||
}
|
||||
|
||||
var userPromises = users.map(updateUser);
|
||||
var lastUser = users[users.length - 1];
|
||||
|
||||
return Promise.all(userPromises)
|
||||
.then(function () {
|
||||
processUsers(lastUser._id);
|
||||
});
|
||||
}
|
||||
|
||||
function updateUser (user) {
|
||||
count++;
|
||||
|
||||
// specify user data to change:
|
||||
var set = {'migration': migrationName, 'flags.armoireEmpty': false};
|
||||
|
||||
dbUsers.update({_id: user._id}, {$set:set});
|
||||
|
||||
if (count % progressCount == 0) console.warn(count + ' ' + user._id);
|
||||
if (user._id == authorUuid) console.warn(authorName + ' processed');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function displayData() {
|
||||
console.warn('\n' + count + ' users processed\n');
|
||||
return exiting(0);
|
||||
}
|
||||
|
||||
|
||||
function exiting(code, msg) {
|
||||
code = code || 0; // 0 = success
|
||||
if (code && !msg) { msg = 'ERROR!'; }
|
||||
@@ -58,3 +78,5 @@ function exiting(code, msg) {
|
||||
}
|
||||
process.exit(code);
|
||||
}
|
||||
|
||||
module.exports = processUsers;
|
||||
|
||||
@@ -1,5 +1,39 @@
|
||||
h2 2/1/2017 - RESOLUTIONS CHALLENGE AND TAKE THIS CHALLENGES CONCLUDED; NEW TAKE THIS CHALLENGE
|
||||
h2 2/2/2017 - CUPID HATCHING POTIONS, SUBSCRIPTIONS ON ANDROID, NEW BACKGROUNDS, AND NEW ARMOIRE ITEMS
|
||||
hr
|
||||
tr
|
||||
td
|
||||
.promo_cupid_potions.pull-left.slight-right-margin
|
||||
.promo_backgrounds_armoire_201702.pull-right
|
||||
h3 Cupid Hatching Potions
|
||||
p There's a new pet breed in town! Between now and February 28th, you can buy Cupid Hatching Potions from <a href='/#/options/inventory/drops'>the Market</a> and use them to hatch any standard pet egg. (Magic Hatching Potions do not work on Quest Pet eggs.) Cupid Potion Pets aren't picky, so they'll happily eat any kind of food that you feed them!
|
||||
br
|
||||
p After they're gone, it will be at least a year before the Cupid Hatching Potions are available again, so be sure to get them now!
|
||||
p.small.muted by Willow the Witty and SabreCat
|
||||
tr
|
||||
td
|
||||
h3 Android Update: Subscriptions
|
||||
p There's an exciting new update to our [Android app] (https://play.google.com/store/apps/details?id=com.habitrpg.android.habitica&hl=en). You can now subscribe to Habitica through the app!
|
||||
br
|
||||
p Subscribers help us keep the app running and updating, so as a thank-you, they get exclusive monthly items, the ability to buy gems with gold, and more!
|
||||
br
|
||||
p If you're already a subscriber, you can now use the app to open your monthly gift and buy gems with gold! Thank you for your support, it means a lot to us!
|
||||
br
|
||||
p We’ve also done some minor bug fixes. Be sure to download the update now for a better Habitica experience! If you like the improvements that we’ve been making to our app, please consider reviewing this new version. It really helps us out!
|
||||
p.small.muted by Viirus
|
||||
tr
|
||||
td
|
||||
h3 New Backgrounds and Armoire Items
|
||||
p We’ve added three new backgrounds to the <a href='/#/options/profile/backgrounds'>Background Shop</a>! Now your avatar can climb to the Bell Tower, bask in the wealth of a Treasure Room and pose under the Wedding Arch.
|
||||
br
|
||||
p Plus, there’s new gold-purchasable equipment in the Enchanted Armoire, including the Queen of Hearts set. Better work hard on your real-life tasks to earn all the pieces! Enjoy :)
|
||||
p.small.muted by Casey, AnnDeLune, and CitrineSun
|
||||
|
||||
if menuItem !== 'oldNews'
|
||||
hr
|
||||
a(href='/static/old-news', target='_blank') Read older news
|
||||
|
||||
mixin oldNews
|
||||
h2 2/1/2017 - RESOLUTIONS CHALLENGE AND TAKE THIS CHALLENGES CONCLUDED; NEW TAKE THIS CHALLENGE
|
||||
tr
|
||||
td
|
||||
h3 Resolution Challenge Winners
|
||||
@@ -16,12 +50,6 @@ h2 2/1/2017 - RESOLUTIONS CHALLENGE AND TAKE THIS CHALLENGES CONCLUDED; NEW TAKE
|
||||
br
|
||||
p Congratulations to the winners of the last Take This Challenge, "Multiplayer Co-op Exercise": grand prize winner IvokaOrange, and runners-up nerelleaustralis, Millificent, Soul Brig, wwwave, and Arawasa the Unseen! Plus, all participants in that Challenge have received a piece of the <a href='http://habitica.wikia.com/wiki/Event_Item_Sequences#Take_This_Armor_Set' target='_blank'>Take This item set</a> if they didn't have all the pieces already. It is located in your Rewards column. Enjoy!
|
||||
p.small.muted by Doctor B, the Take This team, Lemoness, and SabreCat
|
||||
|
||||
if menuItem !== 'oldNews'
|
||||
hr
|
||||
a(href='/static/old-news', target='_blank') Read older news
|
||||
|
||||
mixin oldNews
|
||||
h2 1/31/2017 - HABITICA BIRTHDAY PARTY AND LAST CHANCE FOR MANY SPECIAL ITEMS
|
||||
tr
|
||||
td
|
||||
|
||||
Reference in New Issue
Block a user