GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 37b02e...ebbbe1 )
by James
08:59
created

public/js/ff/index.js (1 issue)

Severity
1
/*
2
 * index.js
3
 * Copyright (c) 2017 [email protected]
4
 *
5
 * This file is part of Firefly III.
6
 *
7
 * Firefly III is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License as published by
9
 * the Free Software Foundation, either version 3 of the License, or
10
 * (at your option) any later version.
11
 *
12
 * Firefly III is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
/** global: accountFrontpageUri, today, piggyInfoUri, token, billCount, accountExpenseUri, accountRevenueUri */
22
23
$(function () {
24
    "use strict";
25
    // do chart JS stuff.
26
    drawChart();
27
28
});
29
30
function drawChart() {
31
    "use strict";
32
    lineChart(accountFrontpageUri, 'accounts-chart');
33
34
    if (billCount > 0) {
35
        pieChart('chart/bill/frontpage', 'bills-chart');
36
    }
37
    stackedColumnChart('chart/budget/frontpage', 'budgets-chart');
38
    columnChart('chart/category/frontpage', 'categories-chart');
39
    columnChart(accountExpenseUri, 'expense-accounts-chart');
40
    columnChart(accountRevenueUri, 'revenue-accounts-chart');
41
42
    // get balance box:
43
    getBalanceBox();
44
    getBillsBox();
45
    getAvailableBox();
46
    getNetWorthBox();
47
    getPiggyBanks();
48
49
    //getBoxAmounts();
50
}
51
52
/**
53
 *
54
 */
55
function getPiggyBanks() {
56
    $.getJSON(piggyInfoUri).done(function (data) {
57
        if (data.html.length > 0) {
58
            $('#piggy_bank_overview').html(data.html);
59
        }
60
    });
61
}
62
63
function getNetWorthBox() {
64
    // box-net-worth
65
    $.getJSON('json/box/net-worth').done(function (data) {
66
        $('#box-net-worth').html(data.net_worths.join(', '));
67
    });
68
}
69
70
/**
71
 *
72
 */
73
function getAvailableBox() {
74
    // box-left-to-spend
75
    // box-left-per-day
76
    $.getJSON('json/box/available').done(function (data) {
77
        $('#box-left-to-spend').html(data.left);
78
        $('#box-left-per-day').html(data.perDay);
79
        $('#box-left-to-spend-text').text(data.text);
80
        if(data.overspent === true) {
81
            $('#box-left-to-spend-box').removeClass('bg-green-gradient').addClass('bg-red-gradient');
82
        }
83
    });
84
}
85
86
/**
87
 *
88
 */
89
function getBillsBox() {
90
    // box-bills-unpaid
91
    // box-bills-paid
92
    $.getJSON('json/box/bills').done(function (data) {
93
        $('#box-bills-paid').html(data.paid);
94
        $('#box-bills-unpaid').html(data.unpaid);
95
    });
96
}
97
98
/**
99
 *
100
 */
101
function getBalanceBox() {
102
    // box-balance-sums
103
    // box-balance-list
104
    $.getJSON('json/box/balance').done(function (data) {
105
        if (data.size === 1) {
106
            // show balance in "sums", show single entry in list.
107
            for (x in data.sums) {
108
                $('#box-balance-sums').html(data.sums[x]);
109
                $('#box-balance-list').html(data.incomes[x] + ' / ' + data.expenses[x]);
110
            }
111
            return;
112
        }
113
        // do not use "sums", only use list.
114
        $('#box-balance-progress').remove();
115
        var expense, string, sum, income, current;
116
        var count = 0;
117
        for (x in data.sums) {
118
            if (count > 1) {
119
                return;
120
            }
121
            current = $('#box-balance-list').html();
122
            sum = data.sums[x];
123
            expense = data.expenses[x];
124
            income = data.incomes[x];
125
            string = income + ' / ' + expense + ': ' + sum;
126
127
            $('#box-balance-list').html(current + '<span title="' + string + '">' + string + '</span>' + '<br>');
128
            count++;
129
        }
130
        return;
0 ignored issues
show
This return has no effect and can be removed.
Loading history...
131
    });
132
}