<commit_before>var angular = require('angular');

angular.module('DashCtrl', ['chart.js']).controller('DashController', ['$scope', $scope => {
    const colorScheme = ['#2a9fd6'];

    let weekDays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
    for(let i = 0; i < 6 - (new Date()).getDay(); i++) {
        const back = weekDays.pop();
        weekDays.unshift(back);
    }

    $scope.uploadColors = colorScheme;
    $scope.uploadLabels = weekDays;
    $scope.uploadSeries = ['Uploads'];
    $scope.uploadData = [[10, 20, 30, 20, 15, 20, 45]];
    $scope.uploadOptions = {
        title: {
            display: true,
            text: 'Historical Uploads'
        },
    };

    $scope.viewColors = colorScheme;
    $scope.viewLabels = weekDays;
    $scope.viewSeries = ['Views'];
    $scope.viewData = [[5, 11, 4, 3, 7, 9, 21]];
    $scope.viewOptions = {
        title: {
            display: true,
            text: 'Historical Views'
        }
    };
}]);
{
}<commit_msg>Fix date and label calculation<commit_after>var angular = require('angular');

angular.module('DashCtrl', ['chart.js']).controller('DashController', ['$scope', $scope => {
    const colorScheme = ['#2a9fd6'];

    // Calculate and format descending dates back one week
    const currentDate = new Date();
    const oneDay = 1000 * 60 * 60 * 24;
    let dates = Array.from({length: 7}, (date, i) => new Date(currentDate - oneDay * (6 - i)));
    let labels = dates.map(date => date.toISOString().substr(5, 5));

    $scope.uploadColors = colorScheme;
    $scope.uploadLabels = labels;
    $scope.uploadSeries = ['Uploads'];
    $scope.uploadData = [[10, 20, 30, 20, 15, 20, 45]];
    $scope.uploadOptions = {
        title: {
            display: true,
            text: 'Historical Uploads'
        },
    };

    $scope.viewColors = colorScheme;
    $scope.viewLabels = labels;
    $scope.viewSeries = ['Views'];
    $scope.viewData = [[5, 11, 4, 3, 7, 9, 21]];
    $scope.viewOptions = {
        title: {
            display: true,
            text: 'Historical Views'
        }
    };
}]);
{
}
{'fraction_non_alphanumeric': 0.17488151658767773, 'fraction_numerical': 0.03222748815165877, 'mean_word_length': 2.577966101694915, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5987931', 'n_tokens_mistral': 757, 'n_tokens_neox': 670, 'n_words': 163}