<commit_before>'use strict';

var DEFAULT_ABOUT = {
    about: '<p>\r\nWS Companion gives Windsor Secondary students the ability to find out' +
    ' about events happening at their school, check what classes they have next, find teacher' +
    ' contact information, and find websites and blogs maintained by Windsor Secondary staff.' + 
    ' \r\n</p>\r\n\r\n<p>\r\nLead Developer: <NAME>\r\n</p>\r\n<p>\r\nIdea and ' +
    'Original App: <NAME>\r\n</p>\r\n<p>\r\nData Entry: <NAME>\r\n</p>\r\n\r\n<p>\r\n' + 
    'WS Companion is an unofficial app created by Windsor Secondary students that is not maintained' +
    'by the North Vancouver School District or Windsor Secondary.\r\n</p>',
    support_email: '<EMAIL>'
}

var DEFAULT_YEARSTARTS = [
    {
        "date": "1999-05-21"
    },
    {
        "date": "2015-09-07"
    }
];

var xenon = angular.module('xenon', ['ionic','ionic.service.core', 'ngResource', 'angular-cache', 'ngAnimate']);

function updateLocalNotifications() {
    // updates next ten weekdays of notification
    var notificationDate = new Date();
    // update this from settings later
    notificationDate.setHours(8,30,0,0);
    var notifications = [];
    var i = 0;
    while (i < 10) {
        console.log(notificationDate);
        if (notificationDate.getDay() == 0) {
            notificationDate.incrementDate(1);
        } else if (notificationDate.getDay() == 6) {
            notificationDate.incrementDate(2);
        } else {
            var rotation = notificationDate.getRotation();
            var notification = {
                id: notificationDate.id,
                at: notificationDate,
                text: ("Rotation today: " + rotation[0].toString() + ", " + rotation[1].toString() + ", " + rotation[2].toString() + ", " + rotation[3].toString()),
                icon: "res://icon.png",
            };
            var storedNotification = notificationDate.notification;
            if (storedNotification) {
                if (storedNotification != notification) {
                    // update the existing notification
                    notificationDate.notification = notification;
                }
            } else {
                i++;
                notificationDate.notification = notification;
                notifications.push(notification);
            }
            notificationDate.incrementDate(1);
        }
    }
    console.log(notifications);
    cordova.plugins.notification.local.schedule(notifications);
}

function createErrorPopup(ionicPopup, scope, errTitle, errMessage, errButton) {
    errTitle = typeof errTitle !== 'undefined' ? errTitle : "No Internet Connection";
    errMessage = typeof errMessage !== 'undefined' ? errMessage : "Refresh again when you have an internet connection to get latest information";
    errButton = typeof errButton !== 'undefined' ? errButton : "Ok";

    ionicPopup.show({
                  title: errTitle,
                  subTitle: errMessage,
                  scope: scope,
                  buttons: [
                  {text: errButton},
    ]});
    // $ionicPopup.show({
    //               title: 'No Internet Connection',
    //               subTitle: 'Refresh again when you have an internet connection to get latest information',
    //               scope: $scope,
    //               buttons: [
    //               {text: 'Ok'},
    //             ]});
}
<commit_msg>untested support for special day notifications<commit_after>'use strict';

var DEFAULT_ABOUT = {
    about: '<p>\r\nWS Companion gives Windsor Secondary students the ability to find out' +
    ' about events happening at their school, check what classes they have next, find teacher' +
    ' contact information, and find websites and blogs maintained by Windsor Secondary staff.' + 
    ' \r\n</p>\r\n\r\n<p>\r\nLead Developer: <NAME>\r\n</p>\r\n<p>\r\nIdea and ' +
    'Original App: <NAME>\r\n</p>\r\n<p>\r\nData Entry: <NAME>\r\n</p>\r\n\r\n<p>\r\n' + 
    'WS Companion is an unofficial app created by Windsor Secondary students that is not maintained' +
    'by the North Vancouver School District or Windsor Secondary.\r\n</p>',
    support_email: '<EMAIL>'
}

var DEFAULT_YEARSTARTS = [
    {
        "date": "1999-05-21"
    },
    {
        "date": "2015-09-07"
    }
];

var xenon = angular.module('xenon', ['ionic','ionic.service.core', 'ngResource', 'angular-cache', 'ngAnimate']);

function updateSingleDailyNotification (date) {
    cordova.plugins.notification.local.update(date.notification);
}

function updateLocalNotifications() {
    // updates next ten weekdays of notification
    var notificationDate = new Date();
    // update this from settings later
    notificationDate.setHours(8,30,0,0);
    var notifications = [];
    var i = 0;
    while (i < 10) {
        console.log(notificationDate);
        if (notificationDate.getDay() == 0) {
            notificationDate.incrementDate(1);
        } else if (notificationDate.getDay() == 6) {
            notificationDate.incrementDate(2);
        } else {
            var rotation = notificationDate.getRotation();
            var notification = {
                id: notificationDate.id,
                at: notificationDate,
                text: ("Rotation today: " + rotation[0].toString() + ", " + rotation[1].toString() + ", " + rotation[2].toString() + ", " + rotation[3].toString()),
                icon: "res://icon.png",
            };
            var storedNotification = notificationDate.notification;
            if (storedNotification) {
                if (storedNotification != notification) {
                    // update the existing notification
                    notificationDate.notification = notification;
                }
            } else {
                i++;
                notificationDate.notification = notification;
                notifications.push(notification);
            }
            angular.injector(['xenon']).get('Day').call().getDay({  date: notificationDate.getDate(), 
                                                                    month:notificationDate.getFullYear()
                                                                },
                function(result) {
                    if (result.length > 0) {
                        var dayName = result[0].name;
                        var dayType = result[0].day_type;  
                        var dayAnnouncement = result[0].announcement;
                        var notificationMessage;

                        if (dayType != 'normal') {
                            if (dayType == 'holiday') {
                                notificationMessage = dayName + ': No school today';
                            } else if (dayType == 'pro-d') {
                                notificationMessage = 'Pro-D Day: No school today';
                            } else if (dayType === 'late-start') {
                                notificationMessage = 'Late Start @ 9:50 am today';
                            } else {
                                notificationMessage = dayName + ' today';
                            }

                            var updatedNotification = notificationDate.notification;
                            updatedNotification.text = notificationMessage;
                            notificationDate.notification = updatedNotification;
                            updateSingleDailyNotification(notificationDate);
                        }
                    }
                }
            );
            notificationDate.incrementDate(1);
        }
    }
    console.log(notifications);
    cordova.plugins.notification.local.schedule(notifications);
}

function createErrorPopup(ionicPopup, scope, errTitle, errMessage, errButton) {
    errTitle = typeof errTitle !== 'undefined' ? errTitle : "No Internet Connection";
    errMessage = typeof errMessage !== 'undefined' ? errMessage : "Refresh again when you have an internet connection to get latest information";
    errButton = typeof errButton !== 'undefined' ? errButton : "Ok";

    ionicPopup.show({
                  title: errTitle,
                  subTitle: errMessage,
                  scope: scope,
                  buttons: [
                  {text: errButton},
    ]});
    // $ionicPopup.show({
    //               title: 'No Internet Connection',
    //               subTitle: 'Refresh again when you have an internet connection to get latest information',
    //               scope: $scope,
    //               buttons: [
    //               {text: 'Ok'},
    //             ]});
}

{'fraction_non_alphanumeric': 0.11646305991855731, 'fraction_numerical': 0.008493310063990692, 'mean_word_length': 1.776485788113695, 'pattern_counts': {'":': 4, '<': 33, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2917047', 'n_tokens_mistral': 2245, 'n_tokens_neox': 2120, 'n_words': 545}