<commit_before>(function() {
    'use strict';

    angular
        .module('app.widgets')
        .directive('widgetDummy', widgetDummy)
        .controller('WidgetSettingsCtrl-dummy', WidgetSettingsCtrlDummy)
        .config(function (WidgetsProvider) { 
            WidgetsProvider.$get().registerType({
                type: 'dummy',
                displayName: 'Dummy',
                description: 'A dummy widget - displays the value of an OpenHAB item'
            });
        });

    widgetDummy.$inject = ['$rootScope', '$uibModal', 'OHService'];
    function widgetDummy($rootScope, $modal, OHService) {
        // Usage: <widget-dummy ng-model="widget" />
        //
        // Creates: A dummy widget
        //
        var directive = {
            bindToController: true,
            controller: DummyController,
            controllerAs: 'vm',
            link: link,
            restrict: 'AE',
            templateUrl: 'app/widgets/dummy/dummy.tpl.html',
            scope: {
                ngModel: '='
            }
        };
        return directive;
        
        function link(scope, element, attrs) {
        }
    }
    DummyController.$inject = ['$rootScope', '$scope', 'OHService'];
    function DummyController ($rootScope, $scope, OHService) {
        var vm = this;
        this.widget = this.ngModel;

        function updateValue() {
            var item = OHService.getItem(vm.widget.item);
            if (!item)
                vm.value = "N/A";
            var value = item.state;
            if (vm.widget.format)
                value = sprintf(vm.widget.format, value);
            if (vm.widget.useserverformat && item.stateDescription && item.stateDescription.pattern)
                value = sprintf(item.stateDescription.pattern, value);
            vm.value = value;
        }

        OHService.onUpdate($scope, vm.widget.item, function () {
            updateValue();
        });

    }


    // settings dialog
    WidgetSettingsCtrlDummy.$inject = ['$scope', '$timeout', '$rootScope', '$uibModalInstance', 'widget', 'OHService'];

    function WidgetSettingsCtrlDummy($scope, $timeout, $rootScope, $modalInstance, widget, OHService) {
        $scope.widget = widget;
        $scope.items = OHService.getItems();

        $scope.form = {
            name: widget.name,
            sizeX: widget.sizeX,
            sizeY: widget.sizeY,
            col: widget.col,
            row: widget.row,<commit_msg>Fix N/A value in dummy widget<commit_after>(function() {
    'use strict';

    angular
        .module('app.widgets')
        .directive('widgetDummy', widgetDummy)
        .controller('WidgetSettingsCtrl-dummy', WidgetSettingsCtrlDummy)
        .config(function (WidgetsProvider) { 
            WidgetsProvider.$get().registerType({
                type: 'dummy',
                displayName: 'Dummy',
                description: 'A dummy widget - displays the value of an OpenHAB item'
            });
        });

    widgetDummy.$inject = ['$rootScope', '$uibModal', 'OHService'];
    function widgetDummy($rootScope, $modal, OHService) {
        // Usage: <widget-dummy ng-model="widget" />
        //
        // Creates: A dummy widget
        //
        var directive = {
            bindToController: true,
            controller: DummyController,
            controllerAs: 'vm',
            link: link,
            restrict: 'AE',
            templateUrl: 'app/widgets/dummy/dummy.tpl.html',
            scope: {
                ngModel: '='
            }
        };
        return directive;
        
        function link(scope, element, attrs) {
        }
    }
    DummyController.$inject = ['$rootScope', '$scope', 'OHService'];
    function DummyController ($rootScope, $scope, OHService) {
        var vm = this;
        this.widget = this.ngModel;

        function updateValue() {
            var item = OHService.getItem(vm.widget.item);
            if (!item) {
                vm.value = "N/A";
                return;
            }
            var value = item.state;
            if (vm.widget.format)
                value = sprintf(vm.widget.format, value);
            if (vm.widget.useserverformat && item.stateDescription && item.stateDescription.pattern)
                value = sprintf(item.stateDescription.pattern, value);
            vm.value = value;
        }

        OHService.onUpdate($scope, vm.widget.item, function () {
            updateValue();
        });

    }


    // settings dialog
    WidgetSettingsCtrlDummy.$inject = ['$scope', '$timeout', '$rootScope', '$uibModalInstance', 'widget', 'OHService'];

    function WidgetSettingsCtrlDummy($scope, $timeout, $rootScope, $modalInstance, widget, OHService) {
        $scope.widget = widget;
        $scope.items = OHService.getItems();

        $scope.form = {
            name: widget.name,
            sizeX: widget.sizeX,
            sizeY: widget.sizeY,
            col: widget.col,
            row: widget.row,
{'fraction_non_alphanumeric': 0.12711182622687048, 'fraction_numerical': 0.0, 'mean_word_length': 1.8001126126126126, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6417467', 'n_tokens_mistral': 1373, 'n_tokens_neox': 1323, 'n_words': 283}