<commit_before>'use strict';

angular.module('hobsonApp').
    controller('TasksController', ['$scope', '$interval', 'AppData', 'ApiService', 'TasksService', 'VariablesService', 'DialogContextService', '$modal', 'toastr',
        function($scope, $interval, AppData, ApiService, TasksService, VariablesService, DialogContextService, $modal, toastr) {
            var refreshInterval;

            var setTasks = function(tasks) {
                $scope.tasks = tasks;

                VariablesService.getGlobalVariables($scope.topLevel.links.globalVariables).then(function(results) {
                    if (results.sunrise.value) {
                      $scope.sunrise = createDate(results.sunrise.value).toLocaleTimeString();
                    }
                    if (results.sunset.value) {
                      $scope.sunset = createDate(results.sunset.value).toLocaleTimeString();
                    }
                });
            };

            var createDate = function(s) {
                if (s) {
                  // this is naively assuming that the date comes back in ISO8601 format for the local time zone
                  var d = new Date();
                  d.setHours(parseInt(s.substring(0, 2)));
                  d.setMinutes(parseInt(s.substring(3, 5)));
                  return d;
                } else {
                  return null;
                }
            };

            /**
             * Opens the add task dialog.
             */<commit_msg>Resolved HOBWCN-27 - Sunrise/sunset should not display seconds.<commit_after>'use strict';

angular.module('hobsonApp').
    controller('TasksController', ['$scope', '$interval', 'AppData', 'ApiService', 'TasksService', 'VariablesService', 'DialogContextService', '$modal', 'toastr',
        function($scope, $interval, AppData, ApiService, TasksService, VariablesService, DialogContextService, $modal, toastr) {
            var refreshInterval;

            var setTasks = function(tasks) {
                $scope.tasks = tasks;

                VariablesService.getGlobalVariables($scope.topLevel.links.globalVariables).then(function(results) {
                    if (results.sunrise.value) {
                      var date = createDate(results.sunrise.value);
                      $scope.sunrise = date.toLocaleTimeString().replace(/:\d{2}\s/,' ');
                    }
                    if (results.sunset.value) {
                      var date = createDate(results.sunset.value);
                      $scope.sunset = date.toLocaleTimeString().replace(/:\d{2}\s/,' ');
                    }
                });
            };

            var createDate = function(s) {
                if (s) {
                  // this is naively assuming that the date comes back in ISO8601 format for the local time zone
                  var d = new Date();
                  d.setHours(parseInt(s.substring(0, 2)));
                  d.setMinutes(parseInt(s.substring(3, 5)));
                  return d;
                } else {
                  return null;
                }
            };

            /**
             * Opens the add task dialog.
             */
{'fraction_non_alphanumeric': 0.11708860759493671, 'fraction_numerical': 0.006329113924050633, 'mean_word_length': 1.582516339869281, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2132566', 'n_tokens_mistral': 821, 'n_tokens_neox': 769, 'n_words': 168}