Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
27f270856a
39 changed files with 289 additions and 60 deletions
scripts
|
@ -87,7 +87,7 @@ emailUserInitialRecruiting = (user, callback) ->
|
|||
return callback null, false if DEBUGGING and (totalEmailsSent > 1 or Math.random() > 0.05)
|
||||
++totalEmailsSent
|
||||
name = if user.firstName and user.lastName then "#{user.firstName}" else user.name
|
||||
name = 'Wizard' if not name or name is 'Anoner'
|
||||
name = 'Wizard' if not name or name in ['Anoner', 'Anonymous']
|
||||
team = user.session.levelInfo.team
|
||||
team = team.substr(0, team.length - 1)
|
||||
context =
|
||||
|
|
|
@ -28,11 +28,11 @@ var deteacher = function deteacher(email) {
|
|||
else {
|
||||
print('Unset role', db.users.update({_id: user._id}, {$unset: {role: ''}}));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
db.system.js.save(
|
||||
{
|
||||
_id: 'deteacher',
|
||||
value: deteacher
|
||||
}
|
||||
)
|
||||
);
|
57
scripts/mongodb/stored/getPrepaidsFor.js
Normal file
57
scripts/mongodb/stored/getPrepaidsFor.js
Normal file
|
@ -0,0 +1,57 @@
|
|||
// Script for changing prepaid start/end dates and propagating them to users.
|
||||
|
||||
/*
|
||||
* Usage
|
||||
* ---------------
|
||||
* In mongo shell
|
||||
*
|
||||
* > db.loadServerScripts();
|
||||
* > var prepaids = getPrepaidsFor('some@email.com'); // prints basic stats for prepaids found
|
||||
* > prepaids.models // Raw prepaid data
|
||||
* > prepaids.setStart(2001,1,1) // Set start date
|
||||
* > prepaids.setEnd(2100,1,1) // Set end date
|
||||
*/
|
||||
|
||||
|
||||
function getPrepaidsFor(email) {
|
||||
var user = db.users.findOne({emailLower: email.toLowerCase()});
|
||||
if (!user) {
|
||||
print('User not found');
|
||||
return;
|
||||
}
|
||||
|
||||
var result = {};
|
||||
result.models = db.prepaids.find({creator: user._id}).toArray();
|
||||
result.setStart = function(year, month, day) {
|
||||
var startDate = new Date(Date.UTC(year, month-1, day)).toISOString();
|
||||
print('setting to', startDate);
|
||||
for (var i in this.models) {
|
||||
var prepaid = this.models[i];
|
||||
print('Prepaid update', db.prepaids.update({_id: prepaid._id}, {$set: {startDate: startDate}}));
|
||||
print('User update', db.users.update({'coursePrepaid._id': prepaid._id}, {$set: {'coursePrepaid.startDate': startDate}}, {multi: true}));
|
||||
}
|
||||
};
|
||||
result.setEnd = function(year, month, day) {
|
||||
var endDate = new Date(Date.UTC(year, month-1, day)).toISOString();
|
||||
print('setting to', endDate);
|
||||
for (var i in this.models) {
|
||||
var prepaid = this.models[i];
|
||||
print('Prepaid update', db.prepaids.update({_id: prepaid._id}, {$set: {endDate: endDate}}));
|
||||
print('User update', db.users.update({'coursePrepaid._id': prepaid._id}, {$set: {'coursePrepaid.endDate': endDate}}, {multi: true}));
|
||||
}
|
||||
};
|
||||
|
||||
for (var i in result.models) {
|
||||
var prepaid = result.models[i];
|
||||
print('Prepaid:', prepaid.startDate, 'to', prepaid.endDate, 'with', prepaid.redeemers.length, '/', prepaid.maxRedeemers, 'uses');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
db.system.js.save(
|
||||
{
|
||||
_id: 'getPrepaidsFor',
|
||||
value: getPrepaidsFor
|
||||
}
|
||||
);
|
13
scripts/vagrant/core/update-brunchv2.sh
Normal file
13
scripts/vagrant/core/update-brunchv2.sh
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash -e
|
||||
# Original content copyright (c) 2014 dpen2000 licensed under the MIT license
|
||||
|
||||
echo "updating brunch to v2..."
|
||||
cd /vagrant
|
||||
npm install \
|
||||
brunch@">=2.0.0" \
|
||||
auto-reload-brunch@">=2.0.0" \
|
||||
coffee-script-brunch@">=2.0.0" \
|
||||
coffeelint-brunch@">=2.0.0" \
|
||||
css-brunch@">=2.0.0" \
|
||||
javascript-brunch@">=2.0.0" \
|
||||
sass-brunch@">=2.0.0" --no-bin-links
|
Reference in a new issue