@sunbird-cb/utils-v2 0.0.16 → 0.0.18

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,7 +2301,11 @@
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) {
2307
+ isEventRecording_1 = false;
2308
+ isEventLive_1 = false;
2305
2309
  var obj = data_1[index];
2306
2310
  var floor = Math.floor;
2307
2311
  var hours = floor(obj.duration / 60);
@@ -2320,7 +2324,28 @@
2320
2324
  var ehour = etime.substr(0, 2);
2321
2325
  var emin = etime.substr(2, 3);
2322
2326
  var endtime = "" + ehour + emin;
2327
+ var eventDate = _this.customDateFormat(obj.startDate, obj.startTime);
2328
+ var eventendDate = _this.customDateFormat(obj.endDate, obj.endTime);
2329
+ var now = new Date();
2330
+ var today = moment(now).format('YYYY-MM-DD HH:mm');
2331
+ if (moment(today).isBetween(eventDate, eventendDate)) {
2332
+ debugger;
2333
+ isEventRecording_1 = false;
2334
+ isEventLive_1 = true;
2335
+ if (today >= eventendDate) {
2336
+ if (obj.recordedLinks && obj.recordedLinks.length > 0) {
2337
+ isEventRecording_1 = true;
2338
+ isEventLive_1 = false;
2339
+ }
2340
+ }
2341
+ }
2342
+ else if (today >= eventendDate) {
2343
+ isEventRecording_1 = true;
2344
+ isEventLive_1 = false;
2345
+ }
2323
2346
  var eventDataObj = {
2347
+ isEventLive: isEventLive_1,
2348
+ isEventRecording: isEventRecording_1,
2324
2349
  event: obj,
2325
2350
  eventName: obj.name,
2326
2351
  eventStartTime: starttime,
@@ -2335,10 +2360,13 @@
2335
2360
  pastevent: false,
2336
2361
  };
2337
2362
  var isToday = _this.compareDate(obj.startDate);
2338
- if (isToday) {
2363
+ if (isToday && isEventLive_1) {
2339
2364
  _this.todaysEvents.push(eventDataObj);
2340
2365
  }
2341
2366
  }));
2367
+ this.todaysEvents = this.todaysEvents.sort((function (a, b) {
2368
+ return (a.isEventLive === b.isEventLive) ? 0 : b.isEventLive ? -1 : 1;
2369
+ }));
2342
2370
  }
2343
2371
  };
2344
2372
  EventService.decorators = [