| Total Complexity | 9 |
| Complexity/F | 2.25 |
| Lines of Code | 46 |
| Function Count | 4 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | function getDepartmentDone(jqXHR) |
||
| 2 | { |
||
| 3 | if(jqXHR.status !== 200 || jqXHR.responseJSON === undefined) |
||
| 4 | { |
||
| 5 | alert('Unable to obtain departments!'); |
||
| 6 | return; |
||
| 7 | } |
||
| 8 | var data = jqXHR.responseJSON; |
||
| 9 | var list = $('#departmentName'); |
||
| 10 | for(var i = 0; i < data.length; i++) |
||
| 11 | { |
||
| 12 | list.append('<option value="'+data[i].departmentID+'">'+data[i].departmentName+'</option>'); |
||
| 13 | } |
||
| 14 | if(data.length === 1) |
||
| 15 | { |
||
| 16 | list.attr('disabled', true); |
||
| 17 | } |
||
| 18 | } |
||
| 19 | |||
| 20 | function addNewShift() |
||
| 21 | { |
||
| 22 | $('#roles').empty(); |
||
| 23 | $('#addShiftModal').modal('show'); |
||
| 24 | } |
||
| 25 | |||
| 26 | function polyfillerLoaded() |
||
| 27 | { |
||
| 28 | webshim.setOptions('basePath', '/js/common/js-webshim/minified/shims/'); |
||
|
|
|||
| 29 | webshim.polyfill(); |
||
| 30 | } |
||
| 31 | |||
| 32 | function initPage() |
||
| 33 | { |
||
| 34 | $('#addShiftModal').modal({show: false}); |
||
| 35 | $.ajax({ |
||
| 36 | url: 'api/v1/departments?$filter=lead eq me', |
||
| 37 | type: 'GET', |
||
| 38 | dataType: 'json', |
||
| 39 | complete: getDepartmentDone}); |
||
| 40 | if(!browser_supports_input_type('datetime-local')) |
||
| 41 | { |
||
| 42 | $.getScript('/js/common/js-webshim/minified/polyfiller.js', polyfillerLoaded); |
||
| 43 | } |
||
| 44 | } |
||
| 45 | |||
| 46 | $(initPage); |
||
| 47 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.