<commit_before>
angular.module('starter.controllers', [])
    .controller('ForecastCtrl', function ($scope, $rootScope, $ionicPlatform, $ionicAnalytics, $ionicScrollDelegate,
                                          $ionicNavBarDelegate, $q, $http, $timeout, WeatherInfo, WeatherUtil, Util,
                                          $stateParams, $location, $ionicHistory) {

        var bodyWidth = window.innerWidth;
        var colWidth;
        var cityData;

        $scope.forecastType = "short"; //mid, detail
        $scope.address = "";

        //{time: Number, t1h: Number, skyIcon: String, tmn: Number, tmx: Number, summary: String};
        $scope.currentWeather;
        //{day: String, time: Number, t3h: Number, skyIcon: String, pop: Number, tempIcon: String, tempInfo: String, tmn: Number, tmx: Number}
        $scope.timeTable = [];
        //{week: String, skyIcon:String, pop: Number, humidityIcon: String, reh: Number, tmn: Number, tmx: Number};
        $scope.dayTable = [];
        //[{name: String, values:[{name: String, value: Number}]}]
        $scope.timeChart;
        //[{values: Object, temp: Number}]
        $scope.dayChart;

        $scope.timeWidth; //total width of timeChart and timeTable
        $scope.dayWidth; //total width of dayChart and dayTable

        $scope.imgPath = Util.imgPath;

        function init() {
            Util.ga.trackEvent('page', 'tab', 'forecast');

            //identifyUser();
            $ionicHistory.clearHistory();

            var padding = 1;
            var smallPadding = 1;
            console.log("Height:" + window.innerHeight + ", Width:" + window.innerWidth + ", PixelRatio:" + window.devicePixelRatio);
            console.log("OuterHeight:" + window.outerHeight + ", OuterWidth:" + window.outerWidth);

            //iphone 4 480-20(status bar)
            if ((window.innerHeight === 460 || window.innerHeight === 480) && window.innerWidth === 320) {
                padding = 1.125;
                smallPadding = 1.1;
            }
            //iphone 5 568-20(status bar)
            if ((window.innerHeight === 548 || window.innerHeight === 568) && window.innerWidth === 320) {
                padding = 1.125;
                smallPadding = 1.1;
            }
            //iphone 6 667-20
            if ((window.innerHeight === 647 || window.innerHeight === 667) && window.innerWidth === 375) {
                padding = 1.0625;
            }

            var mainHeight = window.innerHeight - 100;

            var topTimeSize = mainHeight * 0.026;
            $scope.topTimeSize = topTimeSize<16.8?topTimeSize:16.8;

            var regionSize = mainHeight * 0.0408 * padding; //0.051
            $scope.regionSize = regionSize<33.04?regionSize:33.04;

            var regionSumSize = mainHeight * 0.0376 * padding; //0.047
            $scope.regionSumSize = regionSumSize<30.45?regionSumSize:30.45;

            var bigDigitSize = mainHeight * 0.17544 * padding; //0.2193
            $scope.bigDigitSize = bigDigitSize<142.1?bigDigitSize:142.1;

            var bigTempPointSize = mainHeight * 0.03384 * padding; //0.0423
            $scope.bigTempPointSize = bigTempPointSize<27.4?bigTempPointSize:27.4;

            //injection img url after setting imgSize.
            $scope.reddot = 'reddot';

            var bigSkyStateSize = mainHeight * 0.11264 * padding; //0.1408
            $scope.bigSkyStateSize = bigSkyStateSize<91.2?bigSkyStateSize:91.2;

            var smallTimeSize = mainHeight * 0.0299 * smallPadding;
            $scope.smallTimeSize = smallTimeSize<19.37?smallTimeSize:19.37;

            var smallImageSize = mainHeight * 0.0512 * smallPadding;
            $scope.smallImageSize = smallImageSize<33.17?smallImageSize:33.17;

            var smallDigitSize = mainHeight * 0.0320 * smallPadding;
            $scope.smallDigitSize = smallDigitSize<20.73?smallDigitSize:20.73;

            $scope.isIOS = function() {
                return ionic.Platform.isIOS();
            };
        }

        function loadWeatherData() {
            cityData = WeatherInfo.getCityOfIndex(WeatherInfo.cityIndex);
            if (cityData === null) {
                console.log("fail to getCityOfIndex");
                return;
            }

            console.log("start");

            $scope.timeWidth = getWidthPerCol() * cityData.timeTable.length;
            $scope.dayWidth = getWidthPerCol() * cityData.dayTable.length;

            $scope.address = WeatherUtil.getShortenAddress(cityData.address);
            console.log($scope.address);
            $scope.currentWeather = cityData.currentWeather;
            console.log($scope.currentWeather);
            $scope.timeTable = cityData.timeTable;
            console.log($scope.timeTable);
            $scope.timeChart = cityData.timeChart;
            console.log($scope.timeChart);
            $scope.dayTable = cityData.dayTable;
            console.log($scope.dayTable);
            $scope.dayChart = cityData.dayChart;
            console.log($scope.dayChart);

            $scope.currentPosition = cityData.currentPosition;

            // To share weather information for apple watch.
            // AppleWatch.setWeatherData(cityData);

            $timeout(function() {
                if ($scope.forecastType === 'short') {
                    $ionicScrollDelegate.$getByHandle("timeChart").scrollTo(getTodayPosition(), 0, false);
                }
                else if ($scope.forecastType === 'mid') {
                    $ionicScrollDelegate.$getByHandle("weeklyChart").scrollTo(getTodayPosition(), 0, false);
                }
            },0);

            Util.ga.trackEvent('weather', 'load', $scope.address, WeatherInfo.cityIndex);
        }

        function updateWeatherData(isForce) {
            var deferred = $q.defer();

            if (cityData === null) {
                deferred.resolve();
                return deferred.promise;
            }

            var preUpdate = false;
            var addressUpdate = false;

            if (cityData.location === null && isForce === false) {
                deferred.resolve();
                return deferred.promise;
            }
            if (cityData.currentPosition === false) {
                addressUpdate = true;
            }

            WeatherUtil.getWeatherInfo(cityData.address, WeatherInfo.towns).then(function (weatherDatas) {
                // 1: resolved, 2: rejected
                if (deferred.promise.$$state.status === 1 || deferred.promise.$$state.status === 2) {
                    return;
                }
                preUpdate = true;
                var city = WeatherUtil.convertWeatherData(weatherDatas);
                WeatherInfo.updateCity(WeatherInfo.cityIndex, city);
                loadWeatherData();
                deferred.notify();

                if (addressUpdate === true) {
                    deferred.resolve();
                }
                else {
                    $scope.address = "위치 찾는 중";
                }
            }, function () {
                // 1: resolved, 2: rejected
                if (deferred.promise.$$state.status === 1 || deferred.promise.$$state.status === 2) {
                    return;
                }
                if (addressUpdate === true) {
                    if (cityData.currentPosition === false) {
                        var msg = "위치 정보 업데이트를 실패하였습니다.";
                        $scope.showAlert("에러", msg);
                        deferred.reject();
                    }
                    else {
                        deferred.resolve();
                    }
                }
            });

            if (cityData.currentPosition === true) {
                $scope.address = "위치 찾는 중";

                WeatherUtil.getCurrentPosition().then(function (coords) {
                    WeatherUtil.getAddressFromGeolocation(coords.latitude, coords.longitude).then(function (address) {
                        if (cityData.address === address) {
                            addressUpdate = true;
                            if (preUpdate === true) {
                                console.log("Already updated current position weather data");
                                deferred.resolve();
                            }
                        }
                        else {
                            WeatherUtil.getWeatherInfo(address, WeatherInfo.towns).then(function (weatherDatas) {
                                var city = WeatherUtil.convertWeatherData(weatherDatas);
                                city.address = address;
                                city.location = {"lat": coords.latitude, "long": coords.longitude};
                                WeatherInfo.updateCity(WeatherInfo.cityIndex, city);
                                loadWeatherData();
                                deferred.notify();
                                deferred.resolve();
                            }, function () {
                                var msg = "현재 위치 정보 업데이트를 실패하였습니다.";
                                $scope.showAlert("에러", msg);
                                deferred.reject();
                            });
                        }
                    }, function () {
                        var msg = "현재 위치에 대한 정보를 찾을 수 없습니다.";
                        $scope.showAlert("에러", msg);
                        deferred.reject();
                    });
                }, function () {
                    var msg = "현재 위치를 찾을 수 없습니다.";
                    if (ionic.Platform.isAndroid()) {
                        msg += "<br>WIFI와 위치정보를 켜주세요.";
                    }
                    $scope.showAlert("에러", msg);
                    deferred.reject();
                });
            }

            return deferred.promise;
        }

        function getWidthPerCol() {
            if (colWidth)  {
                return colWidth;
            }

            console.log("body of width="+bodyWidth);
            colWidth = bodyWidth/7;
            if (colWidth > 60) {
                colWidth = 60;
            }
            return colWidth;
        }

        function getTodayPosition() {
            var time = new Date();
            var index = 0;

            if ($scope.forecastType === 'short') {
                var hours = time.getHours();
                index = 7; //yesterday 21h

                //large tablet
                if (bodyWidth >= 720) {
                    return getWidthPerCol()*index;
                }

                if(hours >= 3) {
                    //start today
                    index+=1;
                }
                if (hours >= 6) {
                    index+=1;
                }
                if (hours >= 9) {
                    index += 1;
                }

                return getWidthPerCol()*index;
            }
            else if ($scope.forecastType === 'mid') {

                //large tablet
                if (bodyWidth >= 720) {
                    return 0;
                }

                // Sunday is 0
                var day = time.getDay();
                var dayPadding = 1;

                //monday는 토요일부터 표시
                if (day === 1) {
                    index = 5;
                }
                else {

                    //sunday는 monday까지 보이게
                    if (day === 0) {
                        day = 7;
                        dayPadding += 1;
                    }

                    index = 6 + dayPadding - day;
                }
                return getWidthPerCol()*index;
            }
            return getWidthPerCol()*index;
        }

        $scope.changeForecastType = function() {
            if ($scope.forecastType === 'short') {
                $scope.forecastType = 'mid';
                $rootScope.viewColor = '#8BC34A';
                if (window.StatusBar) {
                    StatusBar.backgroundColorByHexString('#689F38');
                }
                //async drawing for preventing screen cut #544
                setTimeout(function () {
                    $ionicScrollDelegate.$getByHandle("weeklyChart").scrollTo(getTodayPosition(), 0, false);
                }, 0);
            }
            else if ($scope.forecastType === 'mid') {
                $scope.forecastType = 'detail';
                $rootScope.viewColor = '#00BCD4';
                if (window.StatusBar) {
                    StatusBar.backgroundColorByHexString('#0097A7');
                }
            }
            else if ($scope.forecastType === 'detail') {
                $scope.forecastType = 'short';
                $rootScope.viewColor = '#03A9F4';
                if (window.StatusBar) {
                    StatusBar.backgroundColorByHexString('#0288D1');
                }
                setTimeout(function () {
                    $ionicScrollDelegate.$getByHandle("timeChart").scrollTo(getTodayPosition(), 0, false);
                }, 0);
            }
        };

        $scope.doRefresh = function() {
            $scope.isLoading = true;
            updateWeatherData(true).finally(function () {
                $scope.address = WeatherUtil.getShortenAddress(cityData.address);
                $scope.isLoading = false;
            });
        };

        $scope.onSwipeLeft = function() {
            if (WeatherInfo.getCityCount() === 1) {
                return;
            }

            if (WeatherInfo.cityIndex === WeatherInfo.getCityCount() - 1) {
                WeatherInfo.setCityIndex(0);
            }
            else {
                WeatherInfo.setCityIndex(WeatherInfo.cityIndex + 1);
            }

            loadWeatherData();
        };

        $scope.onSwipeRight = function() {
            if (WeatherInfo.getCityCount() === 1) {
                return;
            }

            if (WeatherInfo.cityIndex === 0) {
                WeatherInfo.setCityIndex(WeatherInfo.getCityCount() - 1);
            }
            else {
                WeatherInfo.setCityIndex(WeatherInfo.cityIndex - 1);
            }

            loadWeatherData();
        };

        $scope.getDayText = function (value) {
            return value.fromTodayStr + ' ' + value.date.substr(4,2) + '.' + value.date.substr(6,2);
        };

        $scope.getDayForecast = function (value) {
            var str = '';
            if (value.fromToday === 0 || value.fromToday === 1) {
                if (value.dustForecast && value.dustForecast.PM10Str) {
                   str +=  '미세예보:'+value.dustForecast.PM10Str + ',';
                }

                if (value.ultrvStr) {
                    str += '자외선:'+value.ultrvStr;
                }
                return str;
            }

            return str;
        };

        $scope.$on('$ionicView.loaded', function() {<commit_msg>fixed string error<commit_after>
angular.module('starter.controllers', [])
    .controller('ForecastCtrl', function ($scope, $rootScope, $ionicPlatform, $ionicAnalytics, $ionicScrollDelegate,
                                          $ionicNavBarDelegate, $q, $http, $timeout, WeatherInfo, WeatherUtil, Util,
                                          $stateParams, $location, $ionicHistory) {

        var bodyWidth = window.innerWidth;
        var colWidth;
        var cityData;

        $scope.forecastType = "short"; //mid, detail
        $scope.address = "";

        //{time: Number, t1h: Number, skyIcon: String, tmn: Number, tmx: Number, summary: String};
        $scope.currentWeather;
        //{day: String, time: Number, t3h: Number, skyIcon: String, pop: Number, tempIcon: String, tempInfo: String, tmn: Number, tmx: Number}
        $scope.timeTable = [];
        //{week: String, skyIcon:String, pop: Number, humidityIcon: String, reh: Number, tmn: Number, tmx: Number};
        $scope.dayTable = [];
        //[{name: String, values:[{name: String, value: Number}]}]
        $scope.timeChart;
        //[{values: Object, temp: Number}]
        $scope.dayChart;

        $scope.timeWidth; //total width of timeChart and timeTable
        $scope.dayWidth; //total width of dayChart and dayTable

        $scope.imgPath = Util.imgPath;

        function init() {
            Util.ga.trackEvent('page', 'tab', 'forecast');

            //identifyUser();
            $ionicHistory.clearHistory();

            var padding = 1;
            var smallPadding = 1;
            console.log("Height:" + window.innerHeight + ", Width:" + window.innerWidth + ", PixelRatio:" + window.devicePixelRatio);
            console.log("OuterHeight:" + window.outerHeight + ", OuterWidth:" + window.outerWidth);

            //iphone 4 480-20(status bar)
            if ((window.innerHeight === 460 || window.innerHeight === 480) && window.innerWidth === 320) {
                padding = 1.125;
                smallPadding = 1.1;
            }
            //iphone 5 568-20(status bar)
            if ((window.innerHeight === 548 || window.innerHeight === 568) && window.innerWidth === 320) {
                padding = 1.125;
                smallPadding = 1.1;
            }
            //iphone 6 667-20
            if ((window.innerHeight === 647 || window.innerHeight === 667) && window.innerWidth === 375) {
                padding = 1.0625;
            }

            var mainHeight = window.innerHeight - 100;

            var topTimeSize = mainHeight * 0.026;
            $scope.topTimeSize = topTimeSize<16.8?topTimeSize:16.8;

            var regionSize = mainHeight * 0.0408 * padding; //0.051
            $scope.regionSize = regionSize<33.04?regionSize:33.04;

            var regionSumSize = mainHeight * 0.0376 * padding; //0.047
            $scope.regionSumSize = regionSumSize<30.45?regionSumSize:30.45;

            var bigDigitSize = mainHeight * 0.17544 * padding; //0.2193
            $scope.bigDigitSize = bigDigitSize<142.1?bigDigitSize:142.1;

            var bigTempPointSize = mainHeight * 0.03384 * padding; //0.0423
            $scope.bigTempPointSize = bigTempPointSize<27.4?bigTempPointSize:27.4;

            //injection img url after setting imgSize.
            $scope.reddot = 'reddot';

            var bigSkyStateSize = mainHeight * 0.11264 * padding; //0.1408
            $scope.bigSkyStateSize = bigSkyStateSize<91.2?bigSkyStateSize:91.2;

            var smallTimeSize = mainHeight * 0.0299 * smallPadding;
            $scope.smallTimeSize = smallTimeSize<19.37?smallTimeSize:19.37;

            var smallImageSize = mainHeight * 0.0512 * smallPadding;
            $scope.smallImageSize = smallImageSize<33.17?smallImageSize:33.17;

            var smallDigitSize = mainHeight * 0.0320 * smallPadding;
            $scope.smallDigitSize = smallDigitSize<20.73?smallDigitSize:20.73;

            $scope.isIOS = function() {
                return ionic.Platform.isIOS();
            };
        }

        function loadWeatherData() {
            cityData = WeatherInfo.getCityOfIndex(WeatherInfo.cityIndex);
            if (cityData === null) {
                console.log("fail to getCityOfIndex");
                return;
            }

            console.log("start");

            $scope.timeWidth = getWidthPerCol() * cityData.timeTable.length;
            $scope.dayWidth = getWidthPerCol() * cityData.dayTable.length;

            $scope.address = WeatherUtil.getShortenAddress(cityData.address);
            console.log($scope.address);
            $scope.currentWeather = cityData.currentWeather;
            console.log($scope.currentWeather);
            $scope.timeTable = cityData.timeTable;
            console.log($scope.timeTable);
            $scope.timeChart = cityData.timeChart;
            console.log($scope.timeChart);
            $scope.dayTable = cityData.dayTable;
            console.log($scope.dayTable);
            $scope.dayChart = cityData.dayChart;
            console.log($scope.dayChart);

            $scope.currentPosition = cityData.currentPosition;

            // To share weather information for apple watch.
            // AppleWatch.setWeatherData(cityData);

            $timeout(function() {
                if ($scope.forecastType === 'short') {
                    $ionicScrollDelegate.$getByHandle("timeChart").scrollTo(getTodayPosition(), 0, false);
                }
                else if ($scope.forecastType === 'mid') {
                    $ionicScrollDelegate.$getByHandle("weeklyChart").scrollTo(getTodayPosition(), 0, false);
                }
            },0);

            Util.ga.trackEvent('weather', 'load', $scope.address, WeatherInfo.cityIndex);
        }

        function updateWeatherData(isForce) {
            var deferred = $q.defer();

            if (cityData === null) {
                deferred.resolve();
                return deferred.promise;
            }

            var preUpdate = false;
            var addressUpdate = false;

            if (cityData.location === null && isForce === false) {
                deferred.resolve();
                return deferred.promise;
            }
            if (cityData.currentPosition === false) {
                addressUpdate = true;
            }

            WeatherUtil.getWeatherInfo(cityData.address, WeatherInfo.towns).then(function (weatherDatas) {
                // 1: resolved, 2: rejected
                if (deferred.promise.$$state.status === 1 || deferred.promise.$$state.status === 2) {
                    return;
                }
                preUpdate = true;
                var city = WeatherUtil.convertWeatherData(weatherDatas);
                WeatherInfo.updateCity(WeatherInfo.cityIndex, city);
                loadWeatherData();
                deferred.notify();

                if (addressUpdate === true) {
                    deferred.resolve();
                }
                else {
                    $scope.address = "위치 찾는 중";
                }
            }, function () {
                // 1: resolved, 2: rejected
                if (deferred.promise.$$state.status === 1 || deferred.promise.$$state.status === 2) {
                    return;
                }
                if (addressUpdate === true) {
                    if (cityData.currentPosition === false) {
                        var msg = "위치 정보 업데이트를 실패하였습니다.";
                        $scope.showAlert("에러", msg);
                        deferred.reject();
                    }
                    else {
                        deferred.resolve();
                    }
                }
            });

            if (cityData.currentPosition === true) {
                $scope.address = "위치 찾는 중";

                WeatherUtil.getCurrentPosition().then(function (coords) {
                    WeatherUtil.getAddressFromGeolocation(coords.latitude, coords.longitude).then(function (address) {
                        if (cityData.address === address) {
                            addressUpdate = true;
                            if (preUpdate === true) {
                                console.log("Already updated current position weather data");
                                deferred.resolve();
                            }
                        }
                        else {
                            WeatherUtil.getWeatherInfo(address, WeatherInfo.towns).then(function (weatherDatas) {
                                var city = WeatherUtil.convertWeatherData(weatherDatas);
                                city.address = address;
                                city.location = {"lat": coords.latitude, "long": coords.longitude};
                                WeatherInfo.updateCity(WeatherInfo.cityIndex, city);
                                loadWeatherData();
                                deferred.notify();
                                deferred.resolve();
                            }, function () {
                                var msg = "현재 위치 정보 업데이트를 실패하였습니다.";
                                $scope.showAlert("에러", msg);
                                deferred.reject();
                            });
                        }
                    }, function () {
                        var msg = "현재 위치에 대한 정보를 찾을 수 없습니다.";
                        $scope.showAlert("에러", msg);
                        deferred.reject();
                    });
                }, function () {
                    var msg = "현재 위치를 찾을 수 없습니다.";
                    if (ionic.Platform.isAndroid()) {
                        msg += "<br>WIFI와 위치정보를 켜주세요.";
                    }
                    $scope.showAlert("에러", msg);
                    deferred.reject();
                });
            }

            return deferred.promise;
        }

        function getWidthPerCol() {
            if (colWidth)  {
                return colWidth;
            }

            console.log("body of width="+bodyWidth);
            colWidth = bodyWidth/7;
            if (colWidth > 60) {
                colWidth = 60;
            }
            return colWidth;
        }

        function getTodayPosition() {
            var time = new Date();
            var index = 0;

            if ($scope.forecastType === 'short') {
                var hours = time.getHours();
                index = 7; //yesterday 21h

                //large tablet
                if (bodyWidth >= 720) {
                    return getWidthPerCol()*index;
                }

                if(hours >= 3) {
                    //start today
                    index+=1;
                }
                if (hours >= 6) {
                    index+=1;
                }
                if (hours >= 9) {
                    index += 1;
                }

                return getWidthPerCol()*index;
            }
            else if ($scope.forecastType === 'mid') {

                //large tablet
                if (bodyWidth >= 720) {
                    return 0;
                }

                // Sunday is 0
                var day = time.getDay();
                var dayPadding = 1;

                //monday는 토요일부터 표시
                if (day === 1) {
                    index = 5;
                }
                else {

                    //sunday는 monday까지 보이게
                    if (day === 0) {
                        day = 7;
                        dayPadding += 1;
                    }

                    index = 6 + dayPadding - day;
                }
                return getWidthPerCol()*index;
            }
            return getWidthPerCol()*index;
        }

        $scope.changeForecastType = function() {
            if ($scope.forecastType === 'short') {
                $scope.forecastType = 'mid';
                $rootScope.viewColor = '#8BC34A';
                if (window.StatusBar) {
                    StatusBar.backgroundColorByHexString('#689F38');
                }
                //async drawing for preventing screen cut #544
                setTimeout(function () {
                    $ionicScrollDelegate.$getByHandle("weeklyChart").scrollTo(getTodayPosition(), 0, false);
                }, 0);
            }
            else if ($scope.forecastType === 'mid') {
                $scope.forecastType = 'detail';
                $rootScope.viewColor = '#00BCD4';
                if (window.StatusBar) {
                    StatusBar.backgroundColorByHexString('#0097A7');
                }
            }
            else if ($scope.forecastType === 'detail') {
                $scope.forecastType = 'short';
                $rootScope.viewColor = '#03A9F4';
                if (window.StatusBar) {
                    StatusBar.backgroundColorByHexString('#0288D1');
                }
                setTimeout(function () {
                    $ionicScrollDelegate.$getByHandle("timeChart").scrollTo(getTodayPosition(), 0, false);
                }, 0);
            }
        };

        $scope.doRefresh = function() {
            $scope.isLoading = true;
            updateWeatherData(true).finally(function () {
                $scope.address = WeatherUtil.getShortenAddress(cityData.address);
                $scope.isLoading = false;
            });
        };

        $scope.onSwipeLeft = function() {
            if (WeatherInfo.getCityCount() === 1) {
                return;
            }

            if (WeatherInfo.cityIndex === WeatherInfo.getCityCount() - 1) {
                WeatherInfo.setCityIndex(0);
            }
            else {
                WeatherInfo.setCityIndex(WeatherInfo.cityIndex + 1);
            }

            loadWeatherData();
        };

        $scope.onSwipeRight = function() {
            if (WeatherInfo.getCityCount() === 1) {
                return;
            }

            if (WeatherInfo.cityIndex === 0) {
                WeatherInfo.setCityIndex(WeatherInfo.getCityCount() - 1);
            }
            else {
                WeatherInfo.setCityIndex(WeatherInfo.cityIndex - 1);
            }

            loadWeatherData();
        };

        $scope.getDayText = function (value) {
            return value.fromTodayStr + ' ' + value.date.substr(4,2) + '.' + value.date.substr(6,2);
        };

        $scope.getDayForecast = function (value) {
            var str = '';
            if (value.fromToday === 0 || value.fromToday === 1) {
                if (value.dustForecast && value.dustForecast.PM10Str) {
                   str +=  '미세예보:'+value.dustForecast.PM10Str;
                }

                if (value.ultrvStr) {
                    str += ', ';
                    str += '자외선:'+value.ultrvStr;
                }
                return str;
            }

            return str;
        };

        $scope.$on('$ionicView.loaded', function() {
{'fraction_non_alphanumeric': 0.11429725363489499, 'fraction_numerical': 0.01992460958535272, 'mean_word_length': 1.2985224723447049, 'pattern_counts': {'":': 4, '<': 23, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '897326', 'n_tokens_mistral': 8465, 'n_tokens_neox': 7716, 'n_words': 1453}