@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.
@@ -2092,7 +2092,11 @@ var EventService = (function () {
2092
2092
  if (eventObj !== undefined) {
2093
2093
  this.todaysEvents = [];
2094
2094
  var data_1 = eventObj;
2095
+ var isEventLive_1 = false;
2096
+ var isEventRecording_1 = false;
2095
2097
  Object.keys(data_1).forEach((function (index) {
2098
+ isEventRecording_1 = false;
2099
+ isEventLive_1 = false;
2096
2100
  var obj = data_1[index];
2097
2101
  var floor = Math.floor;
2098
2102
  var hours = floor(obj.duration / 60);
@@ -2111,7 +2115,28 @@ var EventService = (function () {
2111
2115
  var ehour = etime.substr(0, 2);
2112
2116
  var emin = etime.substr(2, 3);
2113
2117
  var endtime = "" + ehour + emin;
2118
+ var eventDate = _this.customDateFormat(obj.startDate, obj.startTime);
2119
+ var eventendDate = _this.customDateFormat(obj.endDate, obj.endTime);
2120
+ var now = new Date();
2121
+ var today = moment(now).format('YYYY-MM-DD HH:mm');
2122
+ if (moment(today).isBetween(eventDate, eventendDate)) {
2123
+ debugger;
2124
+ isEventRecording_1 = false;
2125
+ isEventLive_1 = true;
2126
+ if (today >= eventendDate) {
2127
+ if (obj.recordedLinks && obj.recordedLinks.length > 0) {
2128
+ isEventRecording_1 = true;
2129
+ isEventLive_1 = false;
2130
+ }
2131
+ }
2132
+ }
2133
+ else if (today >= eventendDate) {
2134
+ isEventRecording_1 = true;
2135
+ isEventLive_1 = false;
2136
+ }
2114
2137
  var eventDataObj = {
2138
+ isEventLive: isEventLive_1,
2139
+ isEventRecording: isEventRecording_1,
2115
2140
  event: obj,
2116
2141
  eventName: obj.name,
2117
2142
  eventStartTime: starttime,
@@ -2126,10 +2151,13 @@ var EventService = (function () {
2126
2151
  pastevent: false,
2127
2152
  };
2128
2153
  var isToday = _this.compareDate(obj.startDate);
2129
- if (isToday) {
2154
+ if (isToday && isEventLive_1) {
2130
2155
  _this.todaysEvents.push(eventDataObj);
2131
2156
  }
2132
2157
  }));
2158
+ this.todaysEvents = this.todaysEvents.sort((function (a, b) {
2159
+ return (a.isEventLive === b.isEventLive) ? 0 : b.isEventLive ? -1 : 1;
2160
+ }));
2133
2161
  }
2134
2162
  };
2135
2163
  EventService.decorators = [