В поля коллекции devices добавляются поля имя и фамилия владельца

This commit is contained in:
Denis Smirnov 2013-10-25 18:48:22 +04:00
parent 0de4709514
commit dca233da53
2 changed files with 5 additions and 2 deletions

View File

@ -8,7 +8,7 @@ Template.devices_list.device = function () {
Template.devices_list.get_name_by_id = function () {
var owner = Users.findOne({_id: this.owner_id});
if (!owner) return "Не известно";
return owner.name + " " + owner.surname;
return this.owner_name + " " + this.owner_surname;
};
Template.devices_list.get_checkin_date = function () {

View File

@ -17,7 +17,10 @@ Meteor.startup(function () {
console.log("-------- Устройство: ", device.name);
Devices.update(device._id, {$set: {checkin_date: new Date(), owner_id: user._id}});
Devices.update(device._id, {$set: {checkin_date: new Date(),
owner_id: user._id,
owner_name: user.name,
owner_surname: user.surname}});
});
});