video-webinar-utils
Advanced tools
Comparing version 1.0.18 to 1.0.19
@@ -17,3 +17,3 @@ var | ||
if (rec.hasColumn(field)) { | ||
result = rec.get(field); | ||
result = rec.get(field) || ''; | ||
typeof result === 'string' && (result = escapeHtml(result)); | ||
@@ -82,3 +82,4 @@ } | ||
number: 'Число целое', | ||
string: 'Строка' | ||
string: 'Строка', | ||
boolean: 'Логическое' | ||
}, | ||
@@ -232,3 +233,3 @@ filter = { | ||
duration: 'Совещание.Продолжительность', | ||
authorFaceId: 'ЛицоСоздал' | ||
moderatorFaceId: 'Совещание.Модератор' | ||
}, | ||
@@ -254,5 +255,5 @@ self = this; | ||
return self.getCpsUserIdByFaceId(result.authorFaceId).then(function (presenterCpsUserId) { | ||
delete result.authorFaceId; | ||
result.presenter = presenterCpsUserId; | ||
return self.getCpsUserIdByFaceId(result.moderatorFaceId).then(function (moderatorCpsUserId) { | ||
delete result.moderatorFaceId; | ||
result.moderator = moderatorCpsUserId; | ||
return result; | ||
@@ -262,22 +263,60 @@ }); | ||
}, | ||
getWebinarUsers: function (webinarId) { | ||
_getWebinarUsers: function (webinarId, needPresenters) { | ||
var | ||
params = { | ||
'ИдСовещания': webinarId | ||
}; | ||
if (needPresenters) { | ||
params['Выступающие'] = true; | ||
} | ||
return this._query('ЛицоДокумента.СписокСоСтатусом', params); | ||
}, | ||
_getWebinarViewers: function (webinarId) { | ||
var self = this; | ||
return this._query('ЛицоДокумента.СписокСоСтатусом', { | ||
'ИдСовещания': webinarId | ||
}).then(function (recordSet) { | ||
var promises = []; | ||
recordSet.each(function (record) { | ||
if (_get(record, 'Статус') === 1 || _get(record, 'Организатор')) { | ||
promises.push(self.getUserByFaceId(_get(record, 'Лицо'))); | ||
} | ||
}); | ||
return this._getWebinarUsers(webinarId) | ||
.then(function (recordSet) { | ||
var promises = []; | ||
recordSet.each(function (record) { | ||
if (_get(record, 'Статус') === 1) { | ||
promises.push(self.getUserByFaceId(_get(record, 'Лицо'))); | ||
} | ||
}); | ||
return Q.all(promises).then(function (usersArray) { | ||
var result = {}; | ||
usersArray.forEach(function (user) { | ||
user.potential = true; | ||
result[user.cpsUserId] = user; | ||
return Q.all(promises).then(function (usersArray) { | ||
var result = {}; | ||
usersArray.forEach(function (user) { | ||
user.potential = true; | ||
result[user.cpsUserId] = user; | ||
}); | ||
return result; | ||
}); | ||
}); | ||
return result; | ||
}); | ||
}, | ||
_getWebinarPresenters: function (webinarId) { | ||
var self = this; | ||
return this._getWebinarUsers(webinarId, true) | ||
.then(function (recordSet) { | ||
var promises = []; | ||
recordSet.each(function (record) { | ||
promises.push(self.getUserByFaceId(_get(record, 'Лицо'))); | ||
}); | ||
return Q.all(promises).then(function (usersArray) { | ||
var result = {}; | ||
usersArray.forEach(function (user) { | ||
user.presenter = true; | ||
result[user.cpsUserId] = user; | ||
}); | ||
return result; | ||
}); | ||
}); | ||
}, | ||
getWebinarUsers: function (webinarId) { | ||
return Q.all([ | ||
this._getWebinarPresenters(webinarId), | ||
this._getWebinarViewers(webinarId) | ||
]).then(function (result) { | ||
return $ws.core.merge(result[0], result[1]) | ||
}); | ||
@@ -284,0 +323,0 @@ }, |
{ | ||
"name": "video-webinar-utils", | ||
"version": "1.0.18", | ||
"version": "1.0.19", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "escape-html": "1.0.x", |
@@ -125,3 +125,3 @@ var | ||
* @param {String} eventType - имя события | ||
* @param {Object} data - данные | ||
* @param {Object} [data] - данные | ||
* @param {Object} [additionalInfo] - служебные данные | ||
@@ -128,0 +128,0 @@ * @returns {Q.Promise} |
36233
909