SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r222289732
########## File path: ignite-tc-helper-web/src/main/webapp/comparison.html ########## @@ -173,6 +178,176 @@ return parseFloat(string.substring(string.indexOf("-") + 2, string.lastIndexOf("-") - 1)); } + var ch_disp = function(id) { + let el = document.getElementById(id); + + el.style.display = el.style.display == 'block' ? 'none' : 'block'; + } + + function printTests(num, result) { + let obj = {}; + + try { + obj = JSON.parse(result); + } catch (e) { + showErrInLoadStatus + + return; + } + + if (obj == null) + return; + + let tests = getTests(obj, num); + + window.sessionStorage.setItem('tests' + num, tests); + + $('#MT' + num).html(tests); + } + + function compareHandler() { + var compareMode = window.sessionStorage.compareMode; + + var needTestsUpdate = window.sessionStorage.needTestsUpdate; + + if (needTestsUpdate == 'true') { + let result1 = window.sessionStorage.result1; + + let result2 = window.sessionStorage.result2; + + if (result1 == null || result2 == null) { + alert("Two columns should be loaded for compareMode!"); + + return; + } + + let obj1 = {}; + + let obj2 = {}; + + try { + obj1 = JSON.parse(result1); + + obj2 = JSON.parse(result2); + } catch (e) { + showErrInLoadStatus + } + + window.sessionStorage.uniqTests1 = getUniqueTests(obj1, obj2, 1); + + window.sessionStorage.uniqTests2 = getUniqueTests(obj2, obj1, 2); + + window.sessionStorage.needTestsUpdate = 'false'; + } + + if (compareMode == 'true') { + $('#btt').html("CompareMode"); + + $('#MT1').html(window.sessionStorage.tests1); + + $('#MT2').html(window.sessionStorage.tests2); + + window.sessionStorage.compareMode = 'false'; + } else { + $('#btt').html("FullMode"); + + $('#MT1').html(window.sessionStorage.uniqTests1); + + $('#MT2').html(window.sessionStorage.uniqTests2); + + window.sessionStorage.compareMode = 'true'; + } + + } + + function getUniqueTests(obj1, obj2, num) { + let uniqObj = {}; + + let suites = Object.keys(obj1); + + for (let suite of suites) { + if (!obj2.hasOwnProperty(suite)) { + uniqObj[suite] = obj1[suite]; + + continue; + } + + let tests = obj2[suite]; + + let uniqTests = []; + + for (let v of obj1[suite]) Review comment: Need bracers for multiline `for`. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services