<commit_before>Kamato.register.controller('appActivityCtrl', function ($scope, $http, $modal, ngDialog, $rootScope, $timeout, $routeParams) {

    // ====================== APP管理 top======================
    $scope.app_oper = [
		// {'tip': 'Home', 'icon': 'sa-list-home'},
		{ 'tip': 'Back', 'icon': 'sa-list-back', 'link': '#/platform/APP' },
		{ 'tip': 'Activity', 'icon': 'sa-list-activity', 'link': '#/platform/APP/' + $routeParams.APP + '/APP_activity' },
		{ 'tip': 'Info.', 'icon': 'sa-list-info', 'link': '#/platform/APP/' + $routeParams.APP + '/APP_info' },		// {'tip': 'Upload', 'icon': 'sa-list-upload', 'link': '#/platform/APP/upload'}
 		{ 'tip': 'Folder', 'icon': 'sa-list-folder', 'link': '#/platform/APP/' + $routeParams.APP + '/APP_folder' },
    ];
    // ====================== APP管理 bottom======================
    $scope.app_info = [
        {
            online: 0,
            total: 0,
            network: { in: 0, out: 0 },
            online_history: 0,
            network_history: { in: 0, out: 0 }
        }
    ];
    var users_data = []
    var dataset_users;

    var networks_datain = [];
    var networks_dataout = [];

    var dataset_networks;

    var updateInterval = 1000;
    var start = false;

    $scope.$on("$destroy", function () {
        socket.disconnect();
        socket.removeAllListeners();
    });

    var socket = io('https://simple.tanpopo.cc/' + $routeParams.APP, { autoConnect: false, secure: true });
    socket.on('connect', function () {
    });
    socket.on('disconnect', function (data) {
    });

    // 初始化資料
    socket.on('summary', function (data) {
        if ($('.main-chart').length > 0 && start == false) {
            var netin = data.history.in.reverse();
            var netout = data.history.out.reverse();
            var session = data.history.session.reverse();

            var total = 0;
            for (var i = 0; i < 300; i++) {
                var x = netin[i][0];
                var xx = netin[i][1];
                var y = netout[i][0];
                var yy = netout[i][1];
                var z = session[i][0];
                var zz = session[i][1];

                total += z;

                var netintemp = [xx, x];
                networks_datain.push(netintemp);

                var netouttemp = [yy, y];
                networks_dataout.push(netouttemp);

                var sessiontemp = [zz, z];
                users_data.push(sessiontemp);
            };

            $scope.app_info[0].online = data.current.session;
            $scope.app_info[0].network.in = data.current.in;
            $scope.app_info[0].network.out = data.current.out;
            $scope.app_info[0].total = total;
            $scope.$apply();
            start = true;

        };
    });

    socket.on('data', function (data) {
        if ($('.main-chart').length > 0 && start == true) {
            var din = data.in;
            var dout = data.out;
            var dsession = data.session;

            Get_Data(dsession, din, dout);
            $.plot($("#Users"), dataset_users, options1);
            $.plot($("#Networks"), dataset_networks, options2)

            $scope.app_info[0].online = dsession;
            $scope.app_info[0].network.in = din;
            $scope.app_info[0].network.out = dout;
            $scope.$apply();
        };<commit_msg>Fix dy time<commit_after>Kamato.register.controller('appActivityCtrl', function ($scope, $http, $modal, ngDialog, $rootScope, $timeout, $routeParams) {

    // ====================== APP管理 top======================
    $scope.app_oper = [
		// {'tip': 'Home', 'icon': 'sa-list-home'},
		{ 'tip': 'Back', 'icon': 'sa-list-back', 'link': '#/platform/APP' },
		{ 'tip': 'Activity', 'icon': 'sa-list-activity', 'link': '#/platform/APP/' + $routeParams.APP + '/APP_activity' },
		{ 'tip': 'Info.', 'icon': 'sa-list-info', 'link': '#/platform/APP/' + $routeParams.APP + '/APP_info' },		// {'tip': 'Upload', 'icon': 'sa-list-upload', 'link': '#/platform/APP/upload'}
 		{ 'tip': 'Folder', 'icon': 'sa-list-folder', 'link': '#/platform/APP/' + $routeParams.APP + '/APP_folder' },
    ];
    // ====================== APP管理 bottom======================
    $scope.app_info = [
        {
            online: 0,
            total: 0,
            network: { in: 0, out: 0 },
            online_history: 0,
            network_history: { in: 0, out: 0 }
        }
    ];
    var users_data = []
    var dataset_users;

    var networks_datain = [];
    var networks_dataout = [];

    var dataset_networks;

    var updateInterval = 1000;
    var start = false;

    $scope.$on("$destroy", function () {
        socket.disconnect();
        socket.removeAllListeners();
    });

    var socket = io('https://simple.tanpopo.cc/' + $routeParams.APP, { autoConnect: false, secure: true });
    socket.on('connect', function () {
    });
    socket.on('disconnect', function (data) {
    });

    // 初始化資料
    socket.on('summary', function (data) {
        if ($('.main-chart').length > 0 && start == false) {
            var netin = data.history.in.reverse();
            var netout = data.history.out.reverse();
            var session = data.history.session.reverse();

            var total = 0;
            for (var i = 0; i < 300; i++) {
                var x = netin[i][0];
                var xx = netin[i][1];
                var y = netout[i][0];
                var yy = netout[i][1];
                var z = session[i][0];
                var zz = session[i][1];

                total += z;

                var netintemp = [xx, x];
                networks_datain.push(netintemp);

                var netouttemp = [yy, y];
                networks_dataout.push(netouttemp);

                var sessiontemp = [zz, z];
                users_data.push(sessiontemp);
            };

            $scope.app_info[0].online = data.current.session[0];
            $scope.app_info[0].network.in = data.current.in[0];
            $scope.app_info[0].network.out = data.current.out[0];
            $scope.app_info[0].total = total[0];
            $scope.$apply();
            start = true;

        };
    });

    socket.on('data', function (data) {
        if ($('.main-chart').length > 0 && start == true) {
            var din = data.in;
            var dout = data.out;
            var dsession = data.session;

            Get_Data(dsession, din, dout);
            $.plot($("#Users"), dataset_users, options1);
            $.plot($("#Networks"), dataset_networks, options2)

            $scope.app_info[0].online = dsession[0];
            $scope.app_info[0].network.in = din[0];
            $scope.app_info[0].network.out = dout[0];
            $scope.$apply();
        };
{'fraction_non_alphanumeric': 0.20163812360387193, 'fraction_numerical': 0.010871183916604616, 'mean_word_length': 1.952087912087912, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '5626852', 'n_tokens_mistral': 2179, 'n_tokens_neox': 2060, 'n_words': 424}