"use strict";

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }

module.exports = {

	getCurrentSeason(callback) {
		var _this = this;

		return _asyncToGenerator(function* () {

			let setting = 'currentSeason';

			// Get latest season from seasons table
			let params = {
				table: 'Seasons',
				id: 'Season'
			};

			try {

				let item = yield _this.db.getLastItemAsync(params);
				if (item) {
					yield _this.updateCustomCacheAsync(setting, item);
					callback(null, item);
				} else {
					callback(null, null);
				}
			} catch (err) {
				blackout.errorInternal(err);
			}
		})();
	}

};
//# sourceMappingURL=current-season.js.map