Completed
Push — master ( 401bbc...02c732 )
by Grant
05:46 queued 02:35
created

MicroReferenceAPI.MicroReference   B

Complexity

Conditions 8
Paths 128

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 8
nc 128
nop 0
dl 0
loc 1
rs 7.3333
c 0
b 0
f 0
1
var MicroReferenceAPI = {};
2
3
MicroReferenceAPI.wrapperClass = "applicant-evidence__skill-attribute--reference";
4
5
MicroReferenceAPI.MicroReference = function (criteria_id) {
6
    this.criteria_id = criteria_id;
7
    this.name = null;
8
    this.email = null;
9
    this.relationship = null;
10
    this.observed_from_date = null;
11
    this.observed_until_date = null;
12
    this.experience_level = null;
13
    this.story = null;
14
15
    /**
16
     * Return true if this object is completed
17
     * @return {Boolean}
18
     */
19
    this.isComplete = function () {
20
        return (this.criteria_id &&
21
                this.name &&
22
                this.email &&
23
                this.relationship &&
24
                this.observed_from_date &&
25
                this.observed_until_date &&
26
                this.experience_level  &&
27
                this.story);
28
    };
29
30
    /**
31
     * Return true if this object is ready to be saved to server
32
     * @return {Boolean}
33
     */
34
    this.isValid = function () {
35
        return this.criteria_id != false;
0 ignored issues
show
Best Practice introduced by
Comparing this.criteria_id to false using the != operator is not safe. Consider using !== instead.
Loading history...
Coding Style introduced by
It is recommended to use !== to compare with false.

Generally, it is recommended to use strict comparison whenever possible and not to rely on the weaker type-juggling comparison operator.

Read more about comparison operations.

Loading history...
36
    };
37
    
38
    this.isEmpty = function() {
39
        return (this.name == null &&
0 ignored issues
show
Best Practice introduced by
Comparing this.name to null using the == operator is not safe. Consider using === instead.
Loading history...
Coding Style introduced by
It is recommended to use === to compare with null.

Generally, it is recommended to use strict comparison whenever possible and not to rely on the weaker type-juggling comparison operator.

Read more about comparison operations.

Loading history...
40
                this.email == null &&
0 ignored issues
show
Best Practice introduced by
Comparing this.email to null using the == operator is not safe. Consider using === instead.
Loading history...
Coding Style introduced by
It is recommended to use === to compare with null.

Generally, it is recommended to use strict comparison whenever possible and not to rely on the weaker type-juggling comparison operator.

Read more about comparison operations.

Loading history...
41
                this.relationship == null &&
0 ignored issues
show
Best Practice introduced by
Comparing this.relationship to null using the == operator is not safe. Consider using === instead.
Loading history...
Coding Style introduced by
It is recommended to use === to compare with null.

Generally, it is recommended to use strict comparison whenever possible and not to rely on the weaker type-juggling comparison operator.

Read more about comparison operations.

Loading history...
42
                this.observed_from_date == null &&
0 ignored issues
show
Best Practice introduced by
Comparing this.observed_from_date to null using the == operator is not safe. Consider using === instead.
Loading history...
Coding Style introduced by
It is recommended to use === to compare with null.

Generally, it is recommended to use strict comparison whenever possible and not to rely on the weaker type-juggling comparison operator.

Read more about comparison operations.

Loading history...
43
                this.observed_until_date == null &&
0 ignored issues
show
Best Practice introduced by
Comparing this.observed_until_date to null using the == operator is not safe. Consider using === instead.
Loading history...
Coding Style introduced by
It is recommended to use === to compare with null.

Generally, it is recommended to use strict comparison whenever possible and not to rely on the weaker type-juggling comparison operator.

Read more about comparison operations.

Loading history...
44
                this.experience_level == null &&
0 ignored issues
show
Best Practice introduced by
Comparing this.experience_level to null using the == operator is not safe. Consider using === instead.
Loading history...
Coding Style introduced by
It is recommended to use === to compare with null.

Generally, it is recommended to use strict comparison whenever possible and not to rely on the weaker type-juggling comparison operator.

Read more about comparison operations.

Loading history...
45
                this.story == null);
0 ignored issues
show
Best Practice introduced by
Comparing this.story to null using the == operator is not safe. Consider using === instead.
Loading history...
Coding Style introduced by
It is recommended to use === to compare with null.

Generally, it is recommended to use strict comparison whenever possible and not to rely on the weaker type-juggling comparison operator.

Read more about comparison operations.

Loading history...
46
    };
47
    
48
    this.nullifyEmptyFields = function() {
49
        this.name = this.name ? this.name : null;
50
        this.email = this.email ? this.email : null;
51
        this.relationship = this.relationship ? this.relationship : null;
52
        this.observed_from_date = this.observed_from_date ? this.observed_from_date : null;
53
        this.observed_until_date = this.observed_until_date ? this.observed_until_date : null;
54
        this.experience_level = this.experience_level ? this.experience_level : null;
55
        this.story = this.story ? this.story : null;
56
    };
57
};
58
59
MicroReferenceAPI.parseApplicationMicroReferenceResponse = function (responseJson) {
60
    var references = [];
61
    for (var i = 0; i < responseJson.length; i++) {
62
        var item = responseJson[i];
63
        var itemRef = item.micro_reference;
64
65
        var criteria_id = item.criteria_id;
66
        var name = itemRef.micro_reference_name;
67
        var email = itemRef.micro_reference_email;
68
        var relationship = itemRef.relationship;
69
        var observed_from_date = itemRef.observed_from_date;
70
        var observed_until_date = itemRef.observed_until_date;
71
        var experience_level = itemRef.experience_level;
72
        var story = itemRef.micro_reference_story;
73
74
        var ref = new MicroReferenceAPI.MicroReference(criteria_id);
75
        ref.name = name;
76
        ref.email = email;
77
        ref.relationship = relationship;
78
        ref.observed_from_date = observed_from_date;
79
        ref.observed_until_date = observed_until_date;
80
        ref.experience_level = experience_level;
81
        ref.story = story;
82
        references.push(ref);
83
    }
84
    return references;
85
};
86
87
MicroReferenceAPI.loadSavedMicroReferencesForJobApplication = function (jobApplicationId) {
88
    DataAPI.getMicroReferencesForApplication(jobApplicationId, function (request) {
0 ignored issues
show
Bug introduced by
The variable DataAPI seems to be never declared. If this is a global, consider adding a /** global: DataAPI */ comment.

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.

Loading history...
89
        //Check that request returned a valid response
90
        if (request.status === 200 && request.response) {
91
            var references = MicroReferenceAPI.parseApplicationMicroReferenceResponse(JSON.parse(request.response));
92
            MicroReferenceAPI.populateApplicationUiMicroReferences(references);
93
        }
94
    });
95
};
96
97
MicroReferenceAPI.populateApplicationUiMicroReferences = function (references) {
98
    for (var i = 0; i < references.length; i++) {
99
        var ref = references[i];
100
        //find appropriate Evidence Panel
101
        var panel = document.querySelector('.applicant-evidence__skill[data-criteria-id="' + ref.criteria_id + '"]');
102
        //if panel exists, set saved values
103
        if (panel) {
104
            var name = panel.querySelector('input[name=\"reference_name\"]');
105
            if (name) {
106
                name.value = ref.name;
107
            }
108
            var email = panel.querySelector('input[name=\"reference_email\"]');
109
            if (email) {
110
                email.value = ref.email;
111
            }
112
            var relationship = panel.querySelector('select[name=\"reference_relationship\"]');
113
            if (relationship) {
114
                relationship.value = ref.relationship;
115
            }
116
            var from_date = panel.querySelector('input[name=\"reference_from_date\"]');
117
            if (from_date) {
118
                from_date.value = ref.observed_from_date;
119
            }
120
            var until_date = panel.querySelector('input[name=\"reference_until_date\"]');
121
            if (until_date) {
122
                until_date.value = ref.observed_until_date;
123
            }
124
            var exp_level = panel.querySelector('select[name=\"reference_exp_level\"]');
125
            if (exp_level) {
126
                exp_level.value = ref.experience_level;
127
            }
128
            var story = panel.querySelector('textarea[name=\"reference_story\"]');
129
            if (story) {
130
                story.value = ref.story;
131
            }
132
            
133
            //Run status change handler, because declartion may now be complete
134
            MicroReferenceAPI.onStatusChange(ref.criteria_id);
135
            
136
            //if new reference is not empty, make sure it appears in ui
137
            //And show status as currently saved
138
            if (!ref.isEmpty()) {
139
                var showButton = panel.querySelector(".applicant-evidence__optional-button--reference");
140
                EvidenceAPI.addMicroReference(showButton);
0 ignored issues
show
Bug introduced by
The variable EvidenceAPI seems to be never declared. If this is a global, consider adding a /** global: EvidenceAPI */ comment.

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.

Loading history...
141
                
142
                EvidenceAPI.setUiSaved(ref.criteria_id, MicroReferenceAPI, true);
143
            }
144
        }
145
    }
146
};
147
148
MicroReferenceAPI.populateApplicationPreviewUiMicroReferences = function (references) {
149
    for (var i = 0; i < references.length; i++) {
150
        var ref = references[i];
151
        //find appropriate Evidence Panel
152
        var panel = document.querySelector('.applicant-evidence-preview__accordion-wrapper[data-criteria-id="' + ref.criteria_id + '"]');
153
        //if panel exists, set saved values
154
        if (panel) {
155
            var name = panel.querySelector('.applicant-evidence-preview__reference-name');
156
            if (name) {
157
                name.innerHTML = ref.name;
158
            }
159
            /*
160
             var email = panel.querySelector('input[name=\"reference_email\"]');
161
             if (email) {
162
             email.value = ref.email;
163
             }
164
             */
165
            var relationship = panel.querySelector('.applicant-evidence-preview__reference-relationship');
166
            if (relationship) {
167
                relationship.innerHTML = ref.relationship;
168
            }
169
            var from_date = panel.querySelector('.applicant-evidence-preview__reference-start-date');
170
            if (from_date) {
171
                from_date.innerHTML = ref.observed_from_date;
172
            }
173
            var until_date = panel.querySelector('.applicant-evidence-preview__reference-end-date');
174
            if (until_date) {
175
                until_date.innerHTML = ref.observed_until_date;
176
            }
177
            /*
178
             var exp_level = panel.querySelector('select[name=\"reference_exp_level\"]');
179
             if (exp_level) {
180
             exp_level.value = ref.experience_level;
181
             }
182
             */
183
            var story = panel.querySelector('.applicant-evidence-preview__reference-copy');
184
            if (story) {
185
                story.innerHTML = ref.story;
186
            }
187
188
            //Hide null-response, and show data
189
            var refContent = panel.querySelector('.applicant-evidence-preview__reference-content');
190
            refContent.classList.remove("hidden");
191
            var nullResponse = panel.querySelector('.applicant-evidence-preview__reference-null');
192
            nullResponse.classList.add("hidden");
193
        }
194
    }
195
};
196
197
198
/**
199
 * Saves all completed references for criteria of given type,
200
 * while Deleteing all incomplete references of the given type.
201
 *
202
 * If criteriaType is undefined, it saves/deletes ALL completed skill declarations.
203
 *
204
 * Call onSuccess if all microreferences are saved/deleted successfully
205
 * Call onFailure if some/all requests returned with unexpected status
206
 *
207
 * @param {string} criteriaType
208
 * @param {function} onSuccess
209
 * @return {undefined}
210
 */
211
MicroReferenceAPI.saveMicroReferences = function (criteriaType, onSuccess, onFailure) {
212
    if (criteriaType) {
213
        var evidencePanels = document.querySelectorAll(".applicant-evidence__skill[data-criteria-type=\"" + criteriaType + "\"]:not(.template)");
214
    } else if (criteriaType === undefined) {
215
        var evidencePanels = document.querySelectorAll(".applicant-evidence__skill:not(.template)");
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable evidencePanels already seems to be declared on line 213. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
Bug introduced by
It seems like evidencePanels was already defined.
Loading history...
216
    } else {
217
        Utilities.debug ? console.log("Cannot save Micro References with given type.") : null;
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
Bug introduced by
The variable Utilities seems to be never declared. If this is a global, consider adding a /** global: Utilities */ comment.

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.

Loading history...
Bug introduced by
Did you forget to assign or call a function?

This error message can for example pop up if you forget to assign the result of a function call to a variable or pass it to another function:

function someFunction(x) {
    (x > 0) ? callFoo() : callBar();
}

// JSHint expects you to assign the result to a variable:
function someFunction(x) {
    var rs = (x > 0) ? callFoo() : callBar();
}

// If you do not use the result, you could also use if statements in the
// case above.
function someFunction(x) {
    if (x > 0) {
        callFoo();
    } else {
        callBar();
    }
}
Loading history...
218
        return;
219
    }
220
221
    var submittedRequests = 0; //to keep track of number of HTTP calls in progress
222
    var requestsSuccessful = true;
223
224
    var applicationId = document.getElementById("jobApplicationJobApplicationId").value;
225
226
    if (!applicationId) {
227
        Utilities.debug ? console.log("Cannot save Micro References without an Application Id") : null;
0 ignored issues
show
Bug introduced by
Did you forget to assign or call a function?

This error message can for example pop up if you forget to assign the result of a function call to a variable or pass it to another function:

function someFunction(x) {
    (x > 0) ? callFoo() : callBar();
}

// JSHint expects you to assign the result to a variable:
function someFunction(x) {
    var rs = (x > 0) ? callFoo() : callBar();
}

// If you do not use the result, you could also use if statements in the
// case above.
function someFunction(x) {
    if (x > 0) {
        callFoo();
    } else {
        callBar();
    }
}
Loading history...
228
        return;
229
    }
230
    for (var i = 0; i < evidencePanels.length; i++) {
0 ignored issues
show
Bug introduced by
The variable evidencePanels seems to be used out of scope.

This error can usually be fixed by declaring the variable in the scope where it is used:

function someFunction() {
    (function() {
        var i = 0;
    })();

    // i is not defined.
    alert(i);
}

// This can be fixed by moving the var statement to the outer scope.

function someFunction() {
    var i;
    (function() {
        i = 1;
    })();

    alert(i);
};
Loading history...
231
        var panel = evidencePanels[i];
0 ignored issues
show
Bug introduced by
The variable evidencePanels seems to be used out of scope.

This error can usually be fixed by declaring the variable in the scope where it is used:

function someFunction() {
    (function() {
        var i = 0;
    })();

    // i is not defined.
    alert(i);
}

// This can be fixed by moving the var statement to the outer scope.

function someFunction() {
    var i;
    (function() {
        i = 1;
    })();

    alert(i);
};
Loading history...
232
        var reference = MicroReferenceAPI.getMicroReferenceFromEvidencePanel(panel);
233
234
        if (reference.isValid()) {
235
            submittedRequests = submittedRequests + 1;
236
            DataAPI.saveMicroReference(reference, reference.criteria_id, applicationId, function (response) {
0 ignored issues
show
Bug introduced by
The variable DataAPI seems to be never declared. If this is a global, consider adding a /** global: DataAPI */ comment.

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.

Loading history...
Bug introduced by
It is generally not recommended to make functions within a loop.

While making functions in a loop will not lead to any runtime error, the code might not behave as you expect as the variables in the scope are not imported by value, but by reference. Let’s take a look at an example:

var funcs = [];
for (var i=0; i<10; i++) {
    funcs.push(function() {
        alert(i);
    });
}

funcs[0](); // alert(10);
funcs[1](); // alert(10);
/// ...
funcs[9](); // alert(10);

If you would instead like to bind the function inside the loop to the value of the variable during that specific iteration, you can create the function from another function:

var createFunc = function(i) {
    return function() {
        alert(i);
    };
};

var funcs = [];
for (var i=0; i<10; i++) {
    funcs.push(createFunc(i));
}

funcs[0](); // alert(0)
funcs[1](); // alert(1)
// ...
funcs[9](); // alert(9)
Loading history...
237
                if (response.status !== 200) {
238
                    requestsSuccessful = false;
239
                }
240
                submittedRequests = submittedRequests - 1;
0 ignored issues
show
Bug introduced by
The variable submittedRequests is changed as part of the for loop for example by submittedRequests + 1 on line 235. Only the value of the last iteration will be visible in this function if it is called after the loop.
Loading history...
241
                if (submittedRequests === 0) {
242
                    if (onSuccess && requestsSuccessful) {
0 ignored issues
show
Bug introduced by
The variable requestsSuccessful is changed as part of the for loop for example by false on line 238. Only the value of the last iteration will be visible in this function if it is called after the loop.
Loading history...
243
                        //Only call onSuccess if all requests have been successful
244
                        onSuccess();
245
                    } else if (onFailure && !requestsSuccessful) {
246
                        onFailure();
247
                    }
248
                }
249
            });
250
        } else {
0 ignored issues
show
Comprehensibility Documentation Best Practice introduced by
This code block is empty. Consider removing it or adding a comment to explain.
Loading history...
251
            //If evidence is not valid, do nothing
252
        }
253
    }
254
    if (onSuccess && submittedRequests === 0) {
255
        //If no requests were made, call onSuccess
256
        onSuccess();
257
    }
258
};
259
260
/**
261
 * Saves one microreference
262
 *
263
 * Call onSuccess if all microreferences are saved/deleted successfully
264
 * Call onFailure if some/all requests returned with unexpected status
265
 *
266
 * @param {string} criteriaType
267
 * @param {function} onSuccess
268
 * @param {function} onFailure
269
 * @return {undefined}
270
 */
271
MicroReferenceAPI.saveSingleMicroReference = function (criteriaId, onSuccess, onFailure) {
272
273
    var panel = document.querySelector(".applicant-evidence__skill[data-criteria-id=\"" + criteriaId + "\"]:not(.template)");
274
275
    var applicationId = document.getElementById("jobApplicationJobApplicationId").value;
276
277
    if (!applicationId) {
278
        Utilities.debug ? console.log("Cannot save Micro References without an Application Id") : null;
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
Bug introduced by
The variable Utilities seems to be never declared. If this is a global, consider adding a /** global: Utilities */ comment.

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.

Loading history...
Bug introduced by
Did you forget to assign or call a function?

This error message can for example pop up if you forget to assign the result of a function call to a variable or pass it to another function:

function someFunction(x) {
    (x > 0) ? callFoo() : callBar();
}

// JSHint expects you to assign the result to a variable:
function someFunction(x) {
    var rs = (x > 0) ? callFoo() : callBar();
}

// If you do not use the result, you could also use if statements in the
// case above.
function someFunction(x) {
    if (x > 0) {
        callFoo();
    } else {
        callBar();
    }
}
Loading history...
279
        return;
280
    }
281
    var reference = MicroReferenceAPI.getMicroReferenceFromEvidencePanel(panel);
282
283
    //Only save if this reference is complete
284
    if (reference.isValid()) {
285
        DataAPI.saveMicroReference(reference, reference.criteria_id, applicationId, function (response) {
0 ignored issues
show
Bug introduced by
The variable DataAPI seems to be never declared. If this is a global, consider adding a /** global: DataAPI */ comment.

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.

Loading history...
286
            if (response.status === 200) {
287
                if (onSuccess)
288
                    onSuccess();
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
289
            } else {
290
                if (onFailure) {
291
                    window.alert(response.response.message);
292
                    onFailure();
293
                }
294
            }
295
296
        });
297
    } else {
298
        window.alert("Reference invalid, cannot save");
299
    }
300
};
301
302
MicroReferenceAPI.deleteMicroReference = function(criteriaId) {
303
    var panel = document.querySelector(".applicant-evidence__skill[data-criteria-id=\"" + criteriaId + "\"]:not(.template)");
304
    panel.querySelector('input[name=\"reference_name\"]').value = "";
305
    panel.querySelector('input[name=\"reference_email\"]').value = "";
306
    panel.querySelector('select[name=\"reference_relationship\"]').value = "";
307
    panel.querySelector('input[name=\"reference_from_date\"]').value = "";
308
    panel.querySelector('input[name=\"reference_until_date\"]').value = "";
309
    panel.querySelector('select[name=\"reference_exp_level\"]').value = "";
310
    panel.querySelector('textarea[name=\"reference_story\"]').value = "";
311
312
    var applicationId = document.getElementById("jobApplicationJobApplicationId").value;
313
314
    if (applicationId) {
315
        DataAPI.deleteMicroReference(criteriaId, applicationId, function(request) {
0 ignored issues
show
Bug introduced by
The variable DataAPI seems to be never declared. If this is a global, consider adding a /** global: DataAPI */ comment.

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.

Loading history...
Unused Code introduced by
The parameter request 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...
316
            //TODO: deal with delete response?
317
        });
318
    }
319
    
320
    MicroReferenceAPI.onStatusChange(criteriaId);
321
};
322
323
MicroReferenceAPI.getMicroReferenceFromEvidencePanel = function (panel) {
324
    var criteria_id = panel.getAttribute("data-criteria-id");
325
    var reference = new MicroReferenceAPI.MicroReference(criteria_id);
326
327
    var name = panel.querySelector('input[name=\"reference_name\"]');
328
    if (name) {
329
        reference.name = name.value;
330
    }
331
    var email = panel.querySelector('input[name=\"reference_email\"]');
332
    if (email) {
333
        reference.email = email.value;
334
    }
335
    var relationship = panel.querySelector('select[name=\"reference_relationship\"]');
336
    if (relationship) {
337
        reference.relationship = relationship.value;
338
    }
339
    var from_date = panel.querySelector('input[name=\"reference_from_date\"]');
340
    if (from_date) {
341
        reference.observed_from_date = from_date.value;
342
    }
343
    var until_date = panel.querySelector('input[name=\"reference_until_date\"]');
344
    if (until_date) {
345
        reference.observed_until_date = until_date.value;
346
    }
347
    var exp_level = panel.querySelector('select[name=\"reference_exp_level\"]');
348
    if (exp_level) {
349
        reference.experience_level = exp_level.value;
350
    }
351
    var story = panel.querySelector('textarea[name=\"reference_story\"]');
352
    if (story) {
353
        reference.story = story.value;
354
    }
355
    reference.nullifyEmptyFields();
356
    return reference;
357
};
358
359
MicroReferenceAPI.onStatusChange = function (criteriaId) {
360
    //If status changes, this can no longer be in a saved state
361
    EvidenceAPI.setUiSaved(criteriaId, MicroReferenceAPI, false);
0 ignored issues
show
Bug introduced by
The variable EvidenceAPI seems to be never declared. If this is a global, consider adding a /** global: EvidenceAPI */ comment.

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.

Loading history...
362
363
    var panel = document.querySelector(".applicant-evidence__skill[data-criteria-id=\"" + criteriaId + "\"]:not(.template)");
364
365
    var reference = MicroReferenceAPI.getMicroReferenceFromEvidencePanel(panel);
366
    
367
    
368
369
    //Use validity to determine Completeness status
370
    EvidenceAPI.setUiComplete(criteriaId, MicroReferenceAPI, reference.isComplete());
371
    
372
    EvidenceAPI.onStatusUpdate();
373
};
374