UNPKG

wcif-helpers

Version:
62 lines 2.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.prettyRoundFormat = exports.getGroupInfoByActivityId = exports.getActivityInfoFromSchedule = void 0; var getActivityInfoFromSchedule = function (roundId, wcif) { var activityToReturn = null; wcif.schedule.venues.forEach(function (venue) { venue.rooms.forEach(function (room) { room.activities.forEach(function (activity) { if (activity.activityCode === roundId) { activityToReturn = activity; } activity.childActivities.forEach(function (childActivity) { if (childActivity.activityCode === roundId) { activityToReturn = childActivity; } }); }); }); }); return activityToReturn; }; exports.getActivityInfoFromSchedule = getActivityInfoFromSchedule; var getGroupInfoByActivityId = function (activityId, wcif) { var groupInfo = null; wcif.schedule.venues.forEach(function (venue) { venue.rooms.forEach(function (room) { room.activities.forEach(function (activity) { if (activity.id === activityId) { groupInfo = activity; } activity.childActivities.forEach(function (childActivity) { if (childActivity.id === activityId) { groupInfo = childActivity; } }); }); }); }); return groupInfo; }; exports.getGroupInfoByActivityId = getGroupInfoByActivityId; var prettyRoundFormat = function (format, cutoffAttempts) { switch (format) { case "1": return "Best of 1"; case "2": return "Best of 2"; case "3": return "Best of 3"; case "a": if (!cutoffAttempts) { return "Average of 5"; } return "Best of ".concat(cutoffAttempts, " / Average of 5"); case "m": return "Mean of 3"; default: return "Unknown"; } }; exports.prettyRoundFormat = prettyRoundFormat; //# sourceMappingURL=schedule.js.map