<commit_before>define(['angular', 'lodash'], function(angular, _) {
    'use strict';

    return ['$scope', 'gettext', 'notify', 'api', 'desks', 'WizardHandler',
        function($scope, gettext, notify, api, desks, WizardHandler) {
            $scope.modalActive = false;
            $scope.step = {
                current: null
            };
            $scope.desk = {
                edit: null
            };
            $scope.desks = {};

            desks.initialize()
            .then(function() {
                $scope.desks = desks.desks;
            });

            $scope.openDesk = function(step, desk) {
                $scope.desk.edit = desk;
                $scope.modalActive = true;
                $scope.step.current = step;
            };

            $scope.cancel = function() {
                $scope.modalActive = false;
                $scope.step.current = null;
                $scope.desk.edit = null;
            };

            $scope.remove = function(desk) {
                api.desks.remove(desk).then(function() {
                    _.remove($scope.desks._items, desk);
                    notify.success(gettext('Desk deleted.'), 3000);
                });
            };

            $scope.getExpiryHours = function(inputMin) {
                return parseInt(inputMin / 60, 10);
            };
            $scope.getExpiryMinutes = function(inputMin) {
                return parseInt(inputMin % 60, 10);
            };
            $scope.getTotalExpiryMinutes = function(contentExpiry) {
                return (contentExpiry.Hours * 60) + contentExpiry.Minutes;
            };

            $scope.setContentExpiryHoursMins = function(container) {
                var objContentExpiry = {
                    Hours: 0,
                    Minutes: 0
                };
                if (typeof (container.content_expiry) !== 'undefined' && (container.content_expiry) !== null) {
                    objContentExpiry.Hours = $scope.getExpiryHours(container.content_expiry);
                    objContentExpiry.Minutes = $scope.getExpiryMinutes(container.content_expiry);
                }
                return objContentExpiry;
            };

            $scope.setSpikeExpiryHoursMins = function(container) {
                var objSpikeExpiry = {
                    Hours: 0,
                    Minutes: 0
                };

                if (typeof (container.content_expiry) !== 'undefined' && (container.spike_expiry) !== null) {
                    objSpikeExpiry.Hours = $scope.getExpiryHours(container.spike_expiry);
                    objSpikeExpiry.Minutes = $scope.getExpiryMinutes(container.spike_expiry);
                }
                return objSpikeExpiry;
            };

        }];
});<commit_msg>[SD-1423] - (re-factored) Enable entering expiry value as hours:minutes<commit_after>define(['angular', 'lodash'], function(angular, _) {
    'use strict';

    return ['$scope', 'gettext', 'notify', 'api', 'desks', 'WizardHandler',
        function($scope, gettext, notify, api, desks, WizardHandler) {
            $scope.modalActive = false;
            $scope.step = {
                current: null
            };
            $scope.desk = {
                edit: null
            };
            $scope.desks = {};

            desks.initialize()
            .then(function() {
                $scope.desks = desks.desks;
            });

            $scope.openDesk = function(step, desk) {
                $scope.desk.edit = desk;
                $scope.modalActive = true;
                $scope.step.current = step;
            };

            $scope.cancel = function() {
                $scope.modalActive = false;
                $scope.step.current = null;
                $scope.desk.edit = null;
            };

            $scope.remove = function(desk) {
                api.desks.remove(desk).then(function() {
                    _.remove($scope.desks._items, desk);
                    notify.success(gettext('Desk deleted.'), 3000);
                });
            };

            function getExpiryHours(inputMin) {
                return Math.floor(inputMin / 60);
            }
            function getExpiryMinutes(inputMin) {
                return Math.floor(inputMin % 60);
            }
            $scope.getTotalExpiryMinutes = function(contentExpiry) {
                return (contentExpiry.Hours * 60) + contentExpiry.Minutes;
            };

            $scope.setContentExpiryHoursMins = function(container) {
                var objContentExpiry = {
                    Hours: 0,
                    Minutes: 0
                };
                if (container.content_expiry != null) {
                    objContentExpiry.Hours = getExpiryHours(container.content_expiry);
                    objContentExpiry.Minutes = getExpiryMinutes(container.content_expiry);
                }
                return objContentExpiry;
            };

            $scope.setSpikeExpiryHoursMins = function(container) {
                var objSpikeExpiry = {
                    Hours: 0,
                    Minutes: 0
                };

                if (container.spike_expiry != null) {
                    objSpikeExpiry.Hours = getExpiryHours(container.spike_expiry);
                    objSpikeExpiry.Minutes = getExpiryMinutes(container.spike_expiry);
                }
                return objSpikeExpiry;
            };

        }];
});
{'fraction_non_alphanumeric': 0.11192660550458716, 'fraction_numerical': 0.0066055045871559635, 'mean_word_length': 1.3638334778837815, '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': '2007592', 'n_tokens_mistral': 1610, 'n_tokens_neox': 1458, 'n_words': 227}