<commit_before>// timelines.js sorts out the time lines for
// a) Site lists
// b) Individual sites
$.ajax({
  url: "./preproc/data/bugzilla/index.json",
  dataType: 'json',
  success: setGlobalVar('masterBugTable'),
  error: function(jqXHR, textStatus, errorThrown){
    alert('Failed to retrieve bug data master table (JSON)');
  }
});

var flagThesePris =  {'P1':1,'P2':2}
var bz_show_bug = 'https://bugzilla.mozilla.org/show_bug.cgi?id=';
var resolvedStates = {'RESOLVED':1,'CLOSED':1,'VERIFIED':1};
var testResults = {};
function retrieveMetaBugs(){}; // sorry, dummy because retrieveTestIndex calls it.. TODO: remove this and fix retrieveTestIndex when AWCY 2.0 is ready to replace AWCY 1.0 ..
retrieveTestIndex();
$(document).ready(function () {
	if(!(window.masterBugTable)){ // TODO: masterBugTable data should load with a good ol' <script> element, not XHR, so we don't need to worry about race conditions here
		setTimeout(arguments.callee, 500);
		return;
	} // try again..
	window.masterBugTable['lists']={};
	var table = document.body.appendChild(document.createElement('table')), row, a;
	table.border=1;
	table.className = 'list-master-table';
	table = table.appendChild(document.createElement('tbody'));
	row = table.appendChild(document.createElement('tr'));
	row.appendChild(document.createElement('th')).appendChild(document.createTextNode('Category'));
	row.appendChild(document.createElement('th')).appendChild(document.createTextNode('Number of sites'));
	row.appendChild(document.createElement('th')).appendChild(document.createTextNode('Status'));
	row.lastChild.width="70%";
//	row.appendChild(document.createElement('th')).appendChild(document.createTextNode('Todo'));
//	row.appendChild(document.createElement('th')).appendChild(document.createTextNode('Closed bugs'));
	for(var i=0, list, listurl; list=topLists[i]; i++){
		row = table.appendChild(document.createElement('tr'));
		row.id='row-'+list.id;
		a = row.appendChild(document.createElement('th')).appendChild(document.createElement('a'));
		a.appendChild(document.createTextNode(list.name));
		a.href = '#list:'+list.id+'-details';
		row.appendChild(document.createElement('td'));
		row.appendChild(document.createElement('td'));
//		row.appendChild(document.createElement('td'));
		row = table.appendChild(document.createElement('tr'));
		row.id = 'list:'+list.id+'-details';
		row.className = 'list-details-row';
		row.appendChild(document.createElement('td')).setAttribute('colspan', 4);
		listurl = topLists[i].url;
		if(/_[a-z]{2}\.json$/.test(listurl))listurl = listurl.replace(/_([a-z]{2})\.json$/, '_$1.cc.json'); // Read the data files with extra ccTLD domains added
		$.ajax({
			  url: 'data/'+listurl,
			  crossDomain:false,
			  dataType: 'json',
			  success: (function(list, listurl){
			    return function(data){
				var id=list.id, tr = document.getElementById('row-'+id), ccTLD = data.ccTLD, data = data.data;
				tr.getElementsByTagName('td')[0].textContent = data.length+' sites. ';
				var todos = [], timedata = [];
				window.masterBugTable['lists'][id] = {data: data };
				// now we have enough data to calculate numbers, severities etc.
				var openBugCount=0, resolvedBugCount=0, hasHighPriIssue = false;
				for(var i = 0, site; site = data[i]; i++){
					if( ! masterBugTable[site] ){
						continue;
					}else if(shouldExcludeUSSite(id, site)){
						// now.. the local lists become more interesting and useful if the big, "global" sites are taken out.
						// So let's skip sites
						continue;
					}
					openBugCount += masterBugTable[site].open.length;
					resolvedBugCount += masterBugTable[site].resolved.length;

					for(var j=0, bug; bug=masterBugTable[site].open[j]; j++){
						if(bug.Opened)timedata.push( [new Date(bug.Opened), 1, 0, bug['Bug ID']+' ☐'] ); // "date object", "change to open count", "change to resolved count"
						if(bug['Last Resolved'] && ( bug.Status in resolvedStates))timedata.push( [new Date(bug['Last Resolved']), -1, 1, bug['Bug ID']+' ☑'] );
						if(bug.Priority && bug.Priority in flagThesePris) hasHighPriIssue = true;
						if(bug.Status === 'NEW' && bug.Whiteboard.indexOf('[contactready]')>-1){
							todos.push( ['Contact '+site+' regarding "'+bug.Summary+'"', bug['Bug ID'], bug.Priority] );
						}else if(bug.Status === 'UNCONFIRMED' || bug.Whiteboard.indexOf('[contactready]')===-1){
							todos.push( ['Analyze "'+bug.Summary+'" problem on '+site, bug['Bug ID'], bug.Priority] );
						}
					}
				}
				if(openBugCount + resolvedBugCount > 0){
					var d = tr.getElementsByTagName('td')[1].appendChild(document.createElement('div'));
					d.className = 'list-status-graph';
					[[resolvedBugCount, 'resolved'], [openBugCount, 'open']].forEach(function(details){
						if(details[0]===0)return;
						var d2;
						(d2=d.appendChild(document.createElement('span'))).appendChild(document.createTextNode(details[0]+' '+details[1]));
						d2.className = details[1];
						d2.style.width = (parseInt((details[0] / (openBugCount+resolvedBugCount))*d.offsetWidth)-1) + 'px';
					});
				}
				window.masterBugTable['lists'][list.id].timedata = timedata;
				window.masterBugTable['lists'][list.id].counts = {open:openBugCount, resolved:resolvedBugCount};
//				tr.getElementsByTagName('td')[1].textContent = openBugCount;
//				tr.getElementsByTagName('td')[2].textContent = resolvedBugCount;
				if(hasHighPriIssue){
					tr.classList.add('major-issue');
				}else if(openBugCount>0){
					tr.classList.add('minor-issue');
				}
				if(todos.length>0){ // will this ever be false? :-p
					var d = tr.getElementsByTagName('td')[1].appendChild(document.createElement('div'));
					d.className = 'todo';<commit_msg>tweaking logic for creating todo list<commit_after>// timelines.js sorts out the time lines for
// a) Site lists
// b) Individual sites
$.ajax({
  url: "./preproc/data/bugzilla/index.json",
  dataType: 'json',
  success: setGlobalVar('masterBugTable'),
  error: function(jqXHR, textStatus, errorThrown){
    alert('Failed to retrieve bug data master table (JSON)');
  }
});

var flagThesePris =  {'P1':1,'P2':2}
var bz_show_bug = 'https://bugzilla.mozilla.org/show_bug.cgi?id=';
var resolvedStates = {'RESOLVED':1,'CLOSED':1,'VERIFIED':1};
var testResults = {};
function retrieveMetaBugs(){}; // sorry, dummy because retrieveTestIndex calls it.. TODO: remove this and fix retrieveTestIndex when AWCY 2.0 is ready to replace AWCY 1.0 ..
retrieveTestIndex();
$(document).ready(function () {
	if(!(window.masterBugTable)){ // TODO: masterBugTable data should load with a good ol' <script> element, not XHR, so we don't need to worry about race conditions here
		setTimeout(arguments.callee, 500);
		return;
	} // try again..
	window.masterBugTable['lists']={};
	var table = document.body.appendChild(document.createElement('table')), row, a;
	table.border=1;
	table.className = 'list-master-table';
	table = table.appendChild(document.createElement('tbody'));
	row = table.appendChild(document.createElement('tr'));
	row.appendChild(document.createElement('th')).appendChild(document.createTextNode('Category'));
	row.appendChild(document.createElement('th')).appendChild(document.createTextNode('Number of sites'));
	row.appendChild(document.createElement('th')).appendChild(document.createTextNode('Status'));
	row.lastChild.width="70%";
//	row.appendChild(document.createElement('th')).appendChild(document.createTextNode('Todo'));
//	row.appendChild(document.createElement('th')).appendChild(document.createTextNode('Closed bugs'));
	for(var i=0, list, listurl; list=topLists[i]; i++){
		row = table.appendChild(document.createElement('tr'));
		row.id='row-'+list.id;
		a = row.appendChild(document.createElement('th')).appendChild(document.createElement('a'));
		a.appendChild(document.createTextNode(list.name));
		a.href = '#list:'+list.id+'-details';
		row.appendChild(document.createElement('td'));
		row.appendChild(document.createElement('td'));
//		row.appendChild(document.createElement('td'));
		row = table.appendChild(document.createElement('tr'));
		row.id = 'list:'+list.id+'-details';
		row.className = 'list-details-row';
		row.appendChild(document.createElement('td')).setAttribute('colspan', 4);
		listurl = topLists[i].url;
		if(/_[a-z]{2}\.json$/.test(listurl))listurl = listurl.replace(/_([a-z]{2})\.json$/, '_$1.cc.json'); // Read the data files with extra ccTLD domains added
		$.ajax({
			  url: 'data/'+listurl,
			  crossDomain:false,
			  dataType: 'json',
			  success: (function(list, listurl){
			    return function(data){
				var id=list.id, tr = document.getElementById('row-'+id), ccTLD = data.ccTLD, data = data.data;
				tr.getElementsByTagName('td')[0].textContent = data.length+' sites. ';
				var todos = [], timedata = [];
				window.masterBugTable['lists'][id] = {data: data };
				// now we have enough data to calculate numbers, severities etc.
				var openBugCount=0, resolvedBugCount=0, hasHighPriIssue = false;
				for(var i = 0, site; site = data[i]; i++){
					if( ! masterBugTable[site] ){
						continue;
					}else if(shouldExcludeUSSite(id, site)){
						// now.. the local lists become more interesting and useful if the big, "global" sites are taken out.
						// So let's skip sites
						continue;
					}
					openBugCount += masterBugTable[site].open.length;
					resolvedBugCount += masterBugTable[site].resolved.length;

					for(var j=0, bug; bug=masterBugTable[site].open[j]; j++){
						if(bug.Summary.indexOf('[meta]')>-1)continue;
						if(bug.Opened)timedata.push( [new Date(bug.Opened), 1, 0, bug['Bug ID']+' ☐'] ); // "date object", "change to open count", "change to resolved count"
						if(bug['Last Resolved'] && ( bug.Status in resolvedStates))timedata.push( [new Date(bug['Last Resolved']), -1, 1, bug['Bug ID']+' ☑'] );
						if(bug.Priority && bug.Priority in flagThesePris) hasHighPriIssue = true;
						if(bug.Status === 'NEW' && bug.Whiteboard.indexOf('[contactready]')>-1){
							todos.push( ['Contact '+site+' regarding "'+bug.Summary+'"', bug['Bug ID'], bug.Priority] );
						}else if(bug.Status === 'UNCONFIRMED' || ( bug.Whiteboard.indexOf('[contactready]')===-1 && bug.Whiteboard.indexOf('[sitewait]')===-1)){
							todos.push( ['Analyze "'+bug.Summary+'" problem on '+site, bug['Bug ID'], bug.Priority] );
						}
					}
				}
				if(openBugCount + resolvedBugCount > 0){
					var d = tr.getElementsByTagName('td')[1].appendChild(document.createElement('div'));
					d.className = 'list-status-graph';
					[[resolvedBugCount, 'resolved'], [openBugCount, 'open']].forEach(function(details){
						if(details[0]===0)return;
						var d2;
						(d2=d.appendChild(document.createElement('span'))).appendChild(document.createTextNode(details[0]+' '+details[1]));
						d2.className = details[1];
						d2.style.width = (parseInt((details[0] / (openBugCount+resolvedBugCount))*d.offsetWidth)-1) + 'px';
					});
				}
				window.masterBugTable['lists'][list.id].timedata = timedata;
				window.masterBugTable['lists'][list.id].counts = {open:openBugCount, resolved:resolvedBugCount};
//				tr.getElementsByTagName('td')[1].textContent = openBugCount;
//				tr.getElementsByTagName('td')[2].textContent = resolvedBugCount;
				if(hasHighPriIssue){
					tr.classList.add('major-issue');
				}else if(openBugCount>0){
					tr.classList.add('minor-issue');
				}
				if(todos.length>0){ // will this ever be false? :-p
					var d = tr.getElementsByTagName('td')[1].appendChild(document.createElement('div'));
					d.className = 'todo';
{'fraction_non_alphanumeric': 0.18225273770206848, 'fraction_numerical': 0.009038762384842691, 'mean_word_length': 4.65732546705998, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1823264', 'n_tokens_mistral': 4226, 'n_tokens_neox': 3661, 'n_words': 718}