<commit_before>define(['lodash', 'moment-timezone', 'filters/lstring', 'filters/moment', 'directives/view-injector', 'directives/print-smart/print-smart-checkout', './meeting-document'], function(_, moment) {
    //'css!./agenda.css' // moved to template

    var CALENDAR_SETTINGS = {
        lastDay: '[Yesterday] - dddd D',
        sameDay: '[Today] - dddd D',
        nextDay: '[Tomorrow] - dddd D',
        sameElse: 'dddd D, MMMM YYYY'
    };

    var DAY_PARTS = [
        { code: 'morning',   end : '13:00'},
        { code: 'afternoon', end : '18:00'},
        { code: 'evening',   end : '24:00'}
    ];

	return ["$scope", "$route", "$http", '$q', 'eventId', 'streamId', function ($scope, $route, $http, $q, eventId, streamId) {

        var _ctrl = $scope.agendaCtrl = this;

        _ctrl.CALENDAR = CALENDAR_SETTINGS;
        _ctrl.expandAll = expandAll;
        _ctrl.streamId = streamId;
        _ctrl.resolveLiteral = function(value) { return function() { return value; }; };

        load();

        //==============================
        //
        //==============================
        function load() {


            var reservations, now;
            var event = $http.get('/api/v2016/event-groups/'+eventId, { params: { f : { timezone:1, MajorEventIDs:1, Title: 1, Description:1, venueId:1, schedule:1 } } }).then(function(res) {

                _ctrl.event = event = res.data;

            }).then(function(){

                now = _ctrl.now = moment.tz($route.current.params.datetime || new Date(), event.timezone).toDate();

                return loadReservations(now);

            }).then(function(reservations){

                if(reservations.length)
                    return reservations;

                //Lookup for first reservation
                var query  = { 'agenda.items': { $exists: true, $ne: [] } };

                return $http.get('/api/v2016/reservations', { params: { q : query, f : { start : 1 }, s: { start : 1 }, fo:1 } }).then(function(res){

                    if(res.data && res.data.start)
                        return loadReservations(new Date(res.data.start));

                    return reservations;
                });

            }).then(function(res){

                reservations = res;<commit_msg>Prevent rollback to start<commit_after>define(['lodash', 'moment-timezone', 'filters/lstring', 'filters/moment', 'directives/view-injector', 'directives/print-smart/print-smart-checkout', './meeting-document'], function(_, moment) {
    //'css!./agenda.css' // moved to template

    var CALENDAR_SETTINGS = {
        lastDay: '[Yesterday] - dddd D',
        sameDay: '[Today] - dddd D',
        nextDay: '[Tomorrow] - dddd D',
        sameElse: 'dddd D, MMMM YYYY'
    };

    var DAY_PARTS = [
        { code: 'morning',   end : '13:00'},
        { code: 'afternoon', end : '18:00'},
        { code: 'evening',   end : '24:00'}
    ];

	return ["$scope", "$route", "$http", '$q', 'eventId', 'streamId', function ($scope, $route, $http, $q, eventId, streamId) {

        var _ctrl = $scope.agendaCtrl = this;

        _ctrl.CALENDAR = CALENDAR_SETTINGS;
        _ctrl.expandAll = expandAll;
        _ctrl.streamId = streamId;
        _ctrl.resolveLiteral = function(value) { return function() { return value; }; };

        load();

        //==============================
        //
        //==============================
        function load() {


            var reservations, now;
            var event = $http.get('/api/v2016/event-groups/'+eventId, { params: { f : { timezone:1, MajorEventIDs:1, Title: 1, Description:1, venueId:1, schedule:1 } } }).then(function(res) {

                _ctrl.event = event = res.data;

            }).then(function(){

                now = _ctrl.now = moment.tz($route.current.params.datetime || new Date(), event.timezone).toDate();

                return loadReservations(now);

            }).then(function(reservations){

                if(reservations.length)
                    return reservations;

                //Lookup for first reservation
                var query  = { 'agenda.items': { $exists: true, $ne: [] } };

                return $http.get('/api/v2016/reservations', { params: { q : query, f : { start : 1 }, s: { start : 1 }, fo:1 } }).then(function(res){

                    if(res.data && res.data.start && now.toISOString() < res.data.start)
                        return loadReservations(new Date(res.data.start));

                    return reservations;
                });

            }).then(function(res){

                reservations = res;
{'fraction_non_alphanumeric': 0.18308026030368763, 'fraction_numerical': 0.012581344902386117, 'mean_word_length': 2.067864271457086, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3417244', 'n_tokens_mistral': 1461, 'n_tokens_neox': 1335, 'n_words': 292}