@sunbird-cb/utils-v2 0.0.15 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2301,6 +2301,8 @@
2301
2301
  if (eventObj !== undefined) {
2302
2302
  this.todaysEvents = [];
2303
2303
  var data_1 = eventObj;
2304
+ var isEventLive_1 = false;
2305
+ var isEventRecording_1 = false;
2304
2306
  Object.keys(data_1).forEach((function (index) {
2305
2307
  var obj = data_1[index];
2306
2308
  var floor = Math.floor;
@@ -2320,7 +2322,27 @@
2320
2322
  var ehour = etime.substr(0, 2);
2321
2323
  var emin = etime.substr(2, 3);
2322
2324
  var endtime = "" + ehour + emin;
2325
+ var eventDate = _this.customDateFormat(obj.startDate, obj.startTime);
2326
+ var eventendDate = _this.customDateFormat(obj.endDate, obj.endTime);
2327
+ var now = new Date();
2328
+ var today = moment(now).format('YYYY-MM-DD HH:mm');
2329
+ if (moment(today).isBetween(eventDate, eventendDate)) {
2330
+ isEventRecording_1 = false;
2331
+ isEventLive_1 = true;
2332
+ if (today >= eventendDate) {
2333
+ if (obj.recordedLinks && obj.recordedLinks.length > 0) {
2334
+ isEventRecording_1 = true;
2335
+ isEventLive_1 = false;
2336
+ }
2337
+ }
2338
+ }
2339
+ else if (today >= eventendDate) {
2340
+ isEventRecording_1 = true;
2341
+ isEventLive_1 = false;
2342
+ }
2323
2343
  var eventDataObj = {
2344
+ isEventLive: isEventLive_1,
2345
+ isEventRecording: isEventRecording_1,
2324
2346
  event: obj,
2325
2347
  eventName: obj.name,
2326
2348
  eventStartTime: starttime,
@@ -2335,10 +2357,13 @@
2335
2357
  pastevent: false,
2336
2358
  };
2337
2359
  var isToday = _this.compareDate(obj.startDate);
2338
- if (isToday) {
2360
+ if (isToday && isEventLive_1) {
2339
2361
  _this.todaysEvents.push(eventDataObj);
2340
2362
  }
2341
2363
  }));
2364
+ this.todaysEvents = this.todaysEvents.sort((function (a, b) {
2365
+ return (a.isEventLive === b.isEventLive) ? 0 : b.isEventLive ? -1 : 1;
2366
+ }));
2342
2367
  }
2343
2368
  };
2344
2369
  EventService.decorators = [
@@ -6045,7 +6070,7 @@
6045
6070
  : '',
6046
6071
  duration: 1,
6047
6072
  }, __assign({ context: __assign({ pdata: __assign({}, this.pData, { id: this.pData.id }) }, (pageContext && pageContext.module ? { env: pageContext.module } : null)), object: __assign({}, (data) && data) }, (this.configSvc.userProfile && this.configSvc.userProfile.userId ?
6048
- null : { actor: { id: 'non-loggedin', type: 'Anonymous User' } })));
6073
+ null : { actor: { id: '', type: 'AnonymousUser' } })));
6049
6074
  }
6050
6075
  else {
6051
6076
  this.logger.error('Error Initializing Telemetry. Config missing.');