challenges: shortcode for tag names & task tooltips

This commit is contained in:
Tyler Renelle
2013-10-31 18:18:34 -07:00
parent 0ce76ee689
commit 58fa97fb19
3 changed files with 17 additions and 6 deletions
+4 -3
View File
@@ -19,19 +19,20 @@ var api = module.exports;
*/
var syncChalToUser = function(chal, user) {
if (!chal || !user) return;
chal.shortName = chal.shortName || chal.name;
// Sync tags
var tags = user.tags || [];
var i = _.findIndex(tags, {id: chal._id})
if (~i) {
if (tags[i].name !== chal.name) {
if (tags[i].name !== chal.shortName) {
// update the name - it's been changed since
user.tags[i].name = chal.name;
user.tags[i].name = chal.shortName;
}
} else {
user.tags.push({
id: chal._id,
name: chal.name,
name: chal.shortName,
challenge: true
});
}
+1
View File
@@ -8,6 +8,7 @@ var Group = require('./group').model;
var ChallengeSchema = new Schema({
_id: {type: String, 'default': helpers.uuid},
name: String,
shortName: String,
description: String,
habits: [TaskSchema],
dailys: [TaskSchema],