Completed
Push — master ( f480bf...21d5d4 )
by Patrick
03:35
created

themes/js/view.js   A

Complexity

Total Complexity 21
Complexity/F 1.91

Size

Lines of Code 103
Function Count 11

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 0
nc 1
dl 0
loc 103
rs 10
c 0
b 0
f 0
wmc 21
mnd 1
bc 21
fnc 11
bpm 1.909
cpm 1.909
noi 9

10 Functions

Rating   Name   Duplication   Size   Complexity  
A view.js ➔ render_event_name 0 4 1
A view.js ➔ render_art_logo 0 8 2
A view.js ➔ render_art_name 0 4 1
A view.js ➔ render_dmv_logo 0 8 2
A view.js ➔ render_camp_logo 0 8 2
A view.js ➔ init_tables 0 10 1
A view.js ➔ render_event_logo 0 8 2
A view.js ➔ render_dmv_name 0 4 1
B view.js ➔ render_event_time 0 25 6
A view.js ➔ render_camp_name 0 4 1
1
function get_id_from_row(row)
2
{
3
    if(row._id.$id !== undefined)
4
    {
5
        return row._id.$id;
6
    }
7
    return row._id;
8
}
9
10
function render_camp_logo(data, type, row, meta)
0 ignored issues
show
Unused Code introduced by
The parameter meta is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
11
{
12
    if(data === undefined)
13
    {
14
        return '';
15
    }
16
    return '<a href="view_tc.php?id='+get_id_from_row(row)+'"><img src="'+data+'" style="max-width:100px; max-height:100px;"/></a>';
17
}
18
19
function render_camp_name(data, type, row, meta)
0 ignored issues
show
Unused Code introduced by
The parameter meta is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
20
{
21
    return '<a href="view_tc.php?id='+get_id_from_row(row)+'">'+data+'</a>';
22
}
23
24
function render_art_logo(data, type, row, meta)
0 ignored issues
show
Unused Code introduced by
The parameter meta is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
25
{
26
    if(data === undefined)
27
    {
28
        return '';
29
    }
30
    return '<a href="view_art.php?id='+get_id_from_row(row)+'"><img src="'+data+'" style="max-width:100px; max-height:100px;"/></a>';
31
}
32
33
function render_art_name(data, type, row, meta)
0 ignored issues
show
Unused Code introduced by
The parameter meta is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
34
{
35
    return '<a href="view_art.php?id='+get_id_from_row(row)+'">'+data+'</a>';
36
}
37
38
function render_dmv_logo(data, type, row, meta)
0 ignored issues
show
Unused Code introduced by
The parameter meta is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
39
{
40
    if(data === undefined)
41
    {
42
        return '';
43
    }
44
    return '<a href="view_dmv.php?id='+get_id_from_row(row)+'"><img src="'+data+'" style="max-width:100px; max-height:100px;"/></a>';
45
}
46
47
function render_dmv_name(data, type, row, meta)
0 ignored issues
show
Unused Code introduced by
The parameter meta is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
48
{
49
    return '<a href="view_dmv.php?id='+get_id_from_row(row)+'">'+data+'</a>';
50
}
51
52
function render_event_logo(data, type, row, meta)
0 ignored issues
show
Unused Code introduced by
The parameter meta is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
53
{
54
    if(data === undefined)
55
    {
56
        return '';
57
    }
58
    return '<a href="view_event.php?id='+get_id_from_row(row)+'"><img src="'+data+'" style="max-width:100px; max-height:100px;"/></a>';
59
}
60
61
function render_event_name(data, type, row, meta)
0 ignored issues
show
Unused Code introduced by
The parameter meta is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
62
{
63
    return '<a href="view_event.php?id='+get_id_from_row(row)+'">'+data+'</a>';
64
}
65
66
function render_event_time(data, type, row, meta)
0 ignored issues
show
Unused Code introduced by
The parameter meta is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
67
{
68
    var ret = [];
69
    if(row.Thursday === 'true')
70
    {
71
        ret.push('Thursday '+row.start+'-'+row.end);
72
    }
73
    if(row.Friday === 'true')
74
    {
75
        ret.push('Friday '+row.start+'-'+row.end);
76
    }
77
    if(row.Saturday === 'true')
78
    {
79
        ret.push('Saturday '+row.start+'-'+row.end);
80
    }
81
    if(row.Sunday === 'true')
82
    {
83
        ret.push('Sunday '+row.start+'-'+row.end);
84
    }
85
    if(row.Monday === 'true')
86
    {
87
        ret.push('Monday '+row.start+'-'+row.end);
88
    }
89
    return ret;
90
}
91
92
function init_tables()
93
{
94
    $('#themeTable').dataTable({
95
        'ajax': 'api/v1/themes?fmt=data-table',
96
        'columns': [
97
            {'data': 'name'},
98
            {'data': 'presenting'}
99
        ]
100
    });
101
}
102
103
$(init_tables);
104