function var descriptionJql summaryJql emailJql if TERMS descriptionJq

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
(function () {
var descriptionJql = '', summaryJql = '', emailJql = '';
if (TERMS[1] != '') {
descriptionJql += 'description ~ "' + TERMS[1] + '"';
summaryJql += 'summary ~ "' + TERMS[1] + '"';
}
if (TERMS[2] != '') {
descriptionJql += (descriptionJql != '' ? ' AND ' : '') + 'description ~ "' + TERMS[2] + '"';
summaryJql += (summaryJql != '' ? ' AND ' : '') + 'summary ~ "' + TERMS[2] + '"';
}
if (TERMS[3] != '') {
emailJql += (emailJql != '' ? ' AND ' : '') + 'E-mail ~ "' + TERMS[3] + '"';
}
var descriptionOrSummaryJql = '';
if (descriptionJql != ''){
descriptionOrSummaryJql += '(' + descriptionJql + ')';}
if (summaryJql != '')
descriptionOrSummaryJql += (descriptionOrSummaryJql != '' ? ' OR ' : '') + '(' + summaryJql + ')';
if (emailJql != '')
descriptionOrSummaryJql += (descriptionOrSummaryJql != '' ? ' OR ' : '') + '(' + emailJql + ')';
var jql = 'project = HR';
if (descriptionOrSummaryJql != '')
jql += ' AND (' + descriptionOrSummaryJql + ')';
return jql;
})();