mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 21:27:23 +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 connectionString = 'mongodb://localhost:27017/habitrpg?auto_reconnect=true'; // FOR TEST DATABASE
|
||||||
var dbUsers = monk(connectionString).get('users', { castIds: false });
|
var dbUsers = monk(connectionString).get('users', { castIds: false });
|
||||||
|
|
||||||
|
|
||||||
function processUsers(lastId) {
|
function processUsers(lastId) {
|
||||||
// specify a query to limit the affected users (empty for all users):
|
// specify a query to limit the affected users (empty for all users):
|
||||||
var query = {
|
var query = {
|
||||||
@@ -45,10 +44,10 @@ function updateUsers (users) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var userPaymentPromises = users.map(updateUser);
|
var userPromises = users.map(updateUser);
|
||||||
var lastUser = users[users.length - 1];
|
var lastUser = users[users.length - 1];
|
||||||
|
|
||||||
return Promise.all(userPaymentPromises)
|
return Promise.all(userPromises)
|
||||||
.then(function () {
|
.then(function () {
|
||||||
processUsers(lastUser._id);
|
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
|
* 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 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,
|
||||||
|
};
|
||||||
|
|
||||||
// specify a query to limit the affected users (empty for all users):
|
if (lastId) {
|
||||||
var query = {
|
query._id = {
|
||||||
'flags.armoireEmpty':true
|
$gt: lastId
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// specify fields we are interested in to limit retrieved data (empty if we're not reading data):
|
dbUsers.find(query, {
|
||||||
var fields = {
|
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 progressCount = 1000;
|
||||||
var count = 0;
|
var count = 0;
|
||||||
dbUsers.findEach(query, fields, {batchSize:250}, function(err, user) {
|
|
||||||
if (err) { return exiting(1, 'ERROR! ' + err); }
|
function updateUsers (users) {
|
||||||
if (!user) {
|
if (!users || users.length === 0) {
|
||||||
console.warn('All appropriate users found and modified.');
|
console.warn('All appropriate users found and modified.');
|
||||||
setTimeout(displayData, 300000);
|
displayData();
|
||||||
return;
|
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++;
|
count++;
|
||||||
|
|
||||||
// specify user data to change:
|
var set = {'migration': migrationName, 'flags.armoireEmpty': false};
|
||||||
var set = {'migration':migrationName, 'flags.armoireEmpty':false};
|
|
||||||
|
|
||||||
dbUsers.update({_id:user._id}, {$set:set});
|
dbUsers.update({_id: user._id}, {$set:set});
|
||||||
|
|
||||||
if (count%progressCount == 0) console.warn(count + ' ' + user._id);
|
if (count % progressCount == 0) console.warn(count + ' ' + user._id);
|
||||||
if (user._id == authorUuid) console.warn(authorName + ' processed');
|
if (user._id == authorUuid) console.warn(authorName + ' processed');
|
||||||
});
|
}
|
||||||
|
|
||||||
|
|
||||||
function displayData() {
|
function displayData() {
|
||||||
console.warn('\n' + count + ' users processed\n');
|
console.warn('\n' + count + ' users processed\n');
|
||||||
return exiting(0);
|
return exiting(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function exiting(code, msg) {
|
function exiting(code, msg) {
|
||||||
code = code || 0; // 0 = success
|
code = code || 0; // 0 = success
|
||||||
if (code && !msg) { msg = 'ERROR!'; }
|
if (code && !msg) { msg = 'ERROR!'; }
|
||||||
@@ -58,3 +78,5 @@ function exiting(code, msg) {
|
|||||||
}
|
}
|
||||||
process.exit(code);
|
process.exit(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports = processUsers;
|
||||||
|
|||||||
@@ -1,27 +1,55 @@
|
|||||||
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
|
hr
|
||||||
tr
|
tr
|
||||||
td
|
td
|
||||||
h3 Resolution Challenge Winners
|
.promo_cupid_potions.pull-left.slight-right-margin
|
||||||
p The winners of the Habitica New Years Resolutions Challenge have been selected! Congratulations to: thesuperalice, booksandchips, Meriah, hazey_sunshine, and Valendro!
|
.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
|
br
|
||||||
p Thank you to everyone who shared your resolutions! We're excited to help you pursue your goals throughout 2017 and beyond!
|
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
|
tr
|
||||||
td
|
td
|
||||||
.promo_takeThis_gear.pull-left.slight-right-margin
|
h3 Android Update: Subscriptions
|
||||||
h3 New Take This Challenge
|
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!
|
||||||
p The next Take This Challenge has launched, <a href='/#/options/groups/challenges/1b242bc7-73a8-4307-aa97-7be7d9a3d1a0'>Notice Me, Senpai!</a>, with a focus on reaching out to others when you're struggling. Be sure to check it out to earn additional pieces of the Take This armor set!
|
|
||||||
br
|
br
|
||||||
p <a href='http://www.takethis.org/' target='_blank'>Take This</a> is a nonprofit that seeks to inform the gamer community about mental health issues, to provide education about mental disorders and mental illness prevention, and to reduce the stigma of mental illness.
|
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
|
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 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!
|
||||||
p.small.muted by Doctor B, the Take This team, Lemoness, and SabreCat
|
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'
|
if menuItem !== 'oldNews'
|
||||||
hr
|
hr
|
||||||
a(href='/static/old-news', target='_blank') Read older news
|
a(href='/static/old-news', target='_blank') Read older news
|
||||||
|
|
||||||
mixin oldNews
|
mixin oldNews
|
||||||
|
h2 2/1/2017 - RESOLUTIONS CHALLENGE AND TAKE THIS CHALLENGES CONCLUDED; NEW TAKE THIS CHALLENGE
|
||||||
|
tr
|
||||||
|
td
|
||||||
|
h3 Resolution Challenge Winners
|
||||||
|
p The winners of the Habitica New Years Resolutions Challenge have been selected! Congratulations to: thesuperalice, booksandchips, Meriah, hazey_sunshine, and Valendro!
|
||||||
|
br
|
||||||
|
p Thank you to everyone who shared your resolutions! We're excited to help you pursue your goals throughout 2017 and beyond!
|
||||||
|
tr
|
||||||
|
td
|
||||||
|
.promo_takeThis_gear.pull-left.slight-right-margin
|
||||||
|
h3 New Take This Challenge
|
||||||
|
p The next Take This Challenge has launched, <a href='/#/options/groups/challenges/1b242bc7-73a8-4307-aa97-7be7d9a3d1a0'>Notice Me, Senpai!</a>, with a focus on reaching out to others when you're struggling. Be sure to check it out to earn additional pieces of the Take This armor set!
|
||||||
|
br
|
||||||
|
p <a href='http://www.takethis.org/' target='_blank'>Take This</a> is a nonprofit that seeks to inform the gamer community about mental health issues, to provide education about mental disorders and mental illness prevention, and to reduce the stigma of mental illness.
|
||||||
|
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
|
||||||
h2 1/31/2017 - HABITICA BIRTHDAY PARTY AND LAST CHANCE FOR MANY SPECIAL ITEMS
|
h2 1/31/2017 - HABITICA BIRTHDAY PARTY AND LAST CHANCE FOR MANY SPECIAL ITEMS
|
||||||
tr
|
tr
|
||||||
td
|
td
|
||||||
|
|||||||
Reference in New Issue
Block a user