Fix typos

This commit is contained in:
Berkeley Martinez
2016-02-10 10:05:51 -08:00
parent dc27f53ecb
commit a4dd9667ca
3 changed files with 15 additions and 10 deletions

View File

@ -430,11 +430,13 @@ module.exports = function(User) {
if (
!updateData ||
typeof updateData !== 'object' ||
Object.keys(updateData).length > 0
!Object.keys(updateData).length
) {
return Observable.throw(new Error(
`updateData must be an object with at least on key,
but got ${updateData}`.split('\n').join(' ')
dedent`
updateData must be an object with at least one key,
but got ${updateData} with ${Object.keys(updateData).length}
`.split('\n').join(' ')
));
}
return this.constructor.update$({ id }, updateData, updateOptions);

View File

@ -84,7 +84,7 @@ export default function certificate(app) {
function verifyCert(certType, req, res, next) {
const { user } = req;
return certTypeIds[certType]()
return certTypeIds[certType]
.flatMap(challenge => {
const {
id,
@ -108,7 +108,7 @@ export default function certificate(app) {
}
};
return req.user.udate$(updateData)
return req.user.update$(updateData)
// If user has commited to nonprofit,
// this will complete his pledge
.flatMap(

View File

@ -84,6 +84,7 @@ function buildUserUpdate(
};
if (
timezone &&
timezone !== 'UTC' &&
(!userTimezone || userTimezone === 'UTC')
) {
@ -538,16 +539,18 @@ module.exports = function(app) {
);
const user = req.user;
return user.updateTo$(updateData)
.doOnNext(count => log('%s documents updated', count))
const points = alreadyCompleted ?
user.progressTimestamps.length :
user.progressTimestamps.length + 1;
return user.update$(updateData)
.doOnNext(({ count }) => log('%s documents updated', count))
.subscribe(
function() {
},
() => {},
next,
function() {
if (type === 'json') {
return res.json({
points: user.progressTimestamps.length,
points,
alreadyCompleted
});
}