<commit_before>
angular.module('dashboard', ['ngAnimate', 'ui.bootstrap'])
    .controller('DashboardController', function($scope,$uibModal, UserFactory,moment) {
        $scope.locations = (UserFactory.currentUser.data.locations !== undefined) ?
          UserFactory.currentUser.data.locations : [];

        $scope.addbar = {
            text: '',
            placeholder: 'Add location'
        };

        $scope.currentLocation = $scope.locations[0];
        $scope.currentReservations = [];

        
        // $scope.currentRoom = [];

        //change the drop down and sets the selected room in scope
        $(".main").on('click', ".dropdown-menu#room li a", function() {
            $scope.roomInput = this.text

            $(this).parents(".dropdown").find('.btn').html($(this).text() + ' <span class="caret"></span>');
            $(this).parents(".dropdown").find('.btn').val($(this).data('value'));
        });

        //change the drop down and sets the selected time in scope
        $(".main").on('click', ".dropdown-menu#time li a", function() {
            $scope.timeInput = this.text
            $(this).parents(".dropdown").find('.btn').html($(this).text() + ' <span class="caret"></span>');
            $(this).parents(".dropdown").find('.btn').val($(this).data('value'));
        });

        $scope.roomInput = ""
        $scope.calendarInput = ""
        $scope.timeInput = ""
        $scope.resDescInput = ""
        $scope.confirmReservation = function(){
            var date =  $scope.eve.eventDate
            var formatted = moment(date).format('DD/MM/YYYY');
            // $scope.calendarInput = $scope.eve.eventDate || ""

            var timeFormatted = function(time){
                var momentObj = moment(time, ["h:mm A"])
                var formattedTime = momentObj.format("HH:mm")
                return formattedTime
            }

            var AddHour = function(time){
                var momentObj = moment(time, ["h:mm A"])
                var newHour = momentObj.add(1,'hour')
                var formattedTime = momentObj.format("HH:mm")
                return formattedTime
            }

            var startTime = timeFormatted($scope.timeInput))
            var endTime = AddHour($scope.timeInput))
            var reservationName = $scope.resDescInput
            var roomId = $scope.roomInput

            // console.log($scope.resDescInput)
            // console.log($scope.roomInput)
            // console.log(formatted)
            // console.log($scope.currentLocation.locationName)
            // console.log($scope.timeInput)
             
             // console.log(endTime)
            // UserFactory.addReservation(locId,roomId,startTime,endTime,reservationName)
        }

        $scope.selectedLocation = function(index) {
            $scope.currentReservations = []
            $scope.currentLocation = $scope.locations[index]

            console.log("was run")
            angular.forEach($scope.currentLocation.rooms, function(index) {
                console.log("reservations: ", index)
                angular.forEach(index.reservations, function(index) {
                    console.log("index: ", index)
                    $scope.currentReservations.push(index)
                })<commit_msg>Update dashboard.js<commit_after>
angular.module('dashboard', ['ngAnimate', 'ui.bootstrap'])
    .controller('DashboardController', function($scope,$uibModal, UserFactory,moment) {
        $scope.locations = (UserFactory.currentUser.data.locations !== undefined) ?
          UserFactory.currentUser.data.locations : [];

        $scope.addbar = {
            text: '',
            placeholder: 'Add location'
        };

        $scope.currentLocation = $scope.locations[0];
        $scope.currentReservations = [];

        
        // $scope.currentRoom = [];

        //change the drop down and sets the selected room in scope
        $(".main").on('click', ".dropdown-menu#room li a", function() {
            $scope.roomInput = this.text

            $(this).parents(".dropdown").find('.btn').html($(this).text() + ' <span class="caret"></span>');
            $(this).parents(".dropdown").find('.btn').val($(this).data('value'));
        });

        //change the drop down and sets the selected time in scope
        $(".main").on('click', ".dropdown-menu#time li a", function() {
            $scope.timeInput = this.text
            $(this).parents(".dropdown").find('.btn').html($(this).text() + ' <span class="caret"></span>');
            $(this).parents(".dropdown").find('.btn').val($(this).data('value'));
        });

        $scope.roomInput = ""
        $scope.calendarInput = ""
        $scope.timeInput = ""
        $scope.resDescInput = ""
        $scope.confirmReservation = function(){
            var date =  $scope.eve.eventDate
            var formatted = moment(date).format('DD/MM/YYYY');
            // $scope.calendarInput = $scope.eve.eventDate || ""

            var timeFormatted = function(time){
                var momentObj = moment(time, ["h:mm A"])
                var formattedTime = momentObj.format("HH:mm")
                return formattedTime
            }

            var AddHour = function(time){
                var momentObj = moment(time, ["h:mm A"])
                var newHour = momentObj.add(1,'hour')
                var formattedTime = momentObj.format("HH:mm")
                return formattedTime
            }

            var startTime = timeFormatted($scope.timeInput))
            var endTime = AddHour($scope.timeInput)
            var reservationName = $scope.resDescInput
            var roomId = $scope.roomInput

            // console.log($scope.resDescInput)
            // console.log($scope.roomInput)
            // console.log(formatted)
            // console.log($scope.currentLocation.locationName)
            // console.log($scope.timeInput)
             
             // console.log(endTime)
            // UserFactory.addReservation(locId,roomId,startTime,endTime,reservationName)
        }

        $scope.selectedLocation = function(index) {
            $scope.currentReservations = []
            $scope.currentLocation = $scope.locations[index]

            console.log("was run")
            angular.forEach($scope.currentLocation.rooms, function(index) {
                console.log("reservations: ", index)
                angular.forEach(index.reservations, function(index) {
                    console.log("index: ", index)
                    $scope.currentReservations.push(index)
                })
{'fraction_non_alphanumeric': 0.15127073504793792, 'fraction_numerical': 0.0006087353523055851, 'mean_word_length': 1.988631195998181, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '3815871', 'n_tokens_mistral': 1769, 'n_tokens_neox': 1699, 'n_words': 285}