<commit_before>/*
requires
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
Maybe jquery as well but not sure
*/

var gss_wedtraining_div_id = "wedtraining";
var gss_sattraining_div_id = "sattraining";
var gss_race_div_id = "racesdiv";

google.load('visualization', '1', {'packages':['corechart']});
google.setOnLoadCallback(getTrainingPlan);

var weekday = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
var month = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];

var ssKey = "<KEY>";
var gurl = "https://docs.google.com/spreadsheets/d/" + ssKey + "/gviz/tq";

function getDateForQuery() {
	var d = new Date();
	return d.getFullYear() + "-" + (d.getMonth()+1) + "-" + d.getDate();
}

function getDateIn7DaysForQuery() {
	var d = new Date();
	var dateInaWeek = new Date(d.getTime() + (35*24*60*60*1000));
	return dateInaWeek.getFullYear() + "-" + (dateInaWeek.getMonth()+1) + "-" + dateInaWeek.getDate();
}

function getTrainingPlan() {
	var opts = {sendMethod: 'auto'};
	var query = new google.visualization.Query(gurl, opts);
	var queryString = "select * where " + 
						"(A >= date '" + getDateForQuery() + "' and A < date '" + getDateIn7DaysForQuery() + "')" +
						//" or F is not null " 
						" or (F = 'r' and A >= date '" + getDateForQuery() + "')" + 
						" Order By A"
						;
	//console.log(queryString);
	query.setQuery(queryString);
	query.send(handleQueryResponse);
}

function handleQueryResponse(response) {
	if (response.isError()) {
		console.error('Problem getting training plan ' + response.getMessage() + ' ' + response.getDetailedMessage());
		return;
	} else {	
		var data = response.getDataTable();
		populateData(data);
	}
}

function populateData(dataTable) {
	var rowCount = dataTable.getNumberOfRows();
	var wedString = [];
	var satString = [];
	var raceString = [];
	
	
	if (rowCount != 2) {
		console.log("There are not exactly 2 entries");
		console.log(dataTable);
	}
	
	for (var i = 0; i < rowCount; i++) {
		var dateVal = dataTable.getValue(i,0);
		if(dataTable.getValue(i,5) == 'r'){
			raceString.push(formatTrainString(dataTable,i))
		} else if(dateVal.getDay() == 3){
			wedString.push(formatTrainString(dataTable,i))
		} else if (dateVal.getDay() == 6) {
			satString.push(formatTrainString(dataTable,i));
		}
	}
	
	//console.log(raceString);
	populatePTag (wedString[0],satString[0],raceString[0]);
	populateExtraTS (wedString,satString, raceString);
}

function getDateString(dateVal) {
	return weekday[dateVal.getDay()] + " " +
			month[dateVal.getMonth()] + " " +<commit_msg>removing console logs.<commit_after>/*
requires
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
Maybe jquery as well but not sure
*/

var gss_wedtraining_div_id = "wedtraining";
var gss_sattraining_div_id = "sattraining";
var gss_race_div_id = "racesdiv";

google.load('visualization', '1', {'packages':['corechart']});
google.setOnLoadCallback(getTrainingPlan);

var weekday = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
var month = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];

var ssKey = "<KEY>";
var gurl = "https://docs.google.com/spreadsheets/d/" + ssKey + "/gviz/tq";

function getDateForQuery() {
	var d = new Date();
	return d.getFullYear() + "-" + (d.getMonth()+1) + "-" + d.getDate();
}

function getDateIn7DaysForQuery() {
	var d = new Date();
	var dateInaWeek = new Date(d.getTime() + (35*24*60*60*1000));
	return dateInaWeek.getFullYear() + "-" + (dateInaWeek.getMonth()+1) + "-" + dateInaWeek.getDate();
}

function getTrainingPlan() {
	var opts = {sendMethod: 'auto'};
	var query = new google.visualization.Query(gurl, opts);
	var queryString = "select * where " + 
						"(A >= date '" + getDateForQuery() + "' and A < date '" + getDateIn7DaysForQuery() + "')" +
						//" or F is not null " 
						" or (F = 'r' and A >= date '" + getDateForQuery() + "')" + 
						" Order By A"
						;
	//console.log(queryString);
	query.setQuery(queryString);
	query.send(handleQueryResponse);
}

function handleQueryResponse(response) {
	if (response.isError()) {
		console.error('Problem getting training plan ' + response.getMessage() + ' ' + response.getDetailedMessage());
		return;
	} else {	
		var data = response.getDataTable();
		populateData(data);
	}
}

function populateData(dataTable) {
	var rowCount = dataTable.getNumberOfRows();
	var wedString = [];
	var satString = [];
	var raceString = [];
	
	
	//if (rowCount != 2) {
	//	console.log("There are not exactly 2 entries");
	//	console.log(dataTable);
	//}
	
	for (var i = 0; i < rowCount; i++) {
		var dateVal = dataTable.getValue(i,0);
		if(dataTable.getValue(i,5) == 'r'){
			raceString.push(formatTrainString(dataTable,i))
		} else if(dateVal.getDay() == 3){
			wedString.push(formatTrainString(dataTable,i))
		} else if (dateVal.getDay() == 6) {
			satString.push(formatTrainString(dataTable,i));
		}
	}
	
	//console.log(raceString);
	populatePTag (wedString[0],satString[0],raceString[0]);
	populateExtraTS (wedString,satString, raceString);
}

function getDateString(dateVal) {
	return weekday[dateVal.getDay()] + " " +
			month[dateVal.getMonth()] + " " +
{'fraction_non_alphanumeric': 0.19256822140507063, 'fraction_numerical': 0.010450938649119411, 'mean_word_length': 4.641921397379913, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, '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': '7205997', 'n_tokens_mistral': 2014, 'n_tokens_neox': 1841, 'n_words': 350}