@sunbird-cb/utils-v2 0.0.16 → 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.
@@ -2092,6 +2092,8 @@ 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) {
2096
2098
  var obj = data_1[index];
2097
2099
  var floor = Math.floor;
@@ -2111,7 +2113,27 @@ var EventService = (function () {
2111
2113
  var ehour = etime.substr(0, 2);
2112
2114
  var emin = etime.substr(2, 3);
2113
2115
  var endtime = "" + ehour + emin;
2116
+ var eventDate = _this.customDateFormat(obj.startDate, obj.startTime);
2117
+ var eventendDate = _this.customDateFormat(obj.endDate, obj.endTime);
2118
+ var now = new Date();
2119
+ var today = moment(now).format('YYYY-MM-DD HH:mm');
2120
+ if (moment(today).isBetween(eventDate, eventendDate)) {
2121
+ isEventRecording_1 = false;
2122
+ isEventLive_1 = true;
2123
+ if (today >= eventendDate) {
2124
+ if (obj.recordedLinks && obj.recordedLinks.length > 0) {
2125
+ isEventRecording_1 = true;
2126
+ isEventLive_1 = false;
2127
+ }
2128
+ }
2129
+ }
2130
+ else if (today >= eventendDate) {
2131
+ isEventRecording_1 = true;
2132
+ isEventLive_1 = false;
2133
+ }
2114
2134
  var eventDataObj = {
2135
+ isEventLive: isEventLive_1,
2136
+ isEventRecording: isEventRecording_1,
2115
2137
  event: obj,
2116
2138
  eventName: obj.name,
2117
2139
  eventStartTime: starttime,
@@ -2126,10 +2148,13 @@ var EventService = (function () {
2126
2148
  pastevent: false,
2127
2149
  };
2128
2150
  var isToday = _this.compareDate(obj.startDate);
2129
- if (isToday) {
2151
+ if (isToday && isEventLive_1) {
2130
2152
  _this.todaysEvents.push(eventDataObj);
2131
2153
  }
2132
2154
  }));
2155
+ this.todaysEvents = this.todaysEvents.sort((function (a, b) {
2156
+ return (a.isEventLive === b.isEventLive) ? 0 : b.isEventLive ? -1 : 1;
2157
+ }));
2133
2158
  }
2134
2159
  };
2135
2160
  EventService.decorators = [