<commit_before>/* global apiKey */
/* global redmineBaseUri */
/* global $ */
var activityViewModel = function (data){
	var logs = ko.observableArray();
	var id = data.id;
	var color = data.color;
	var name = data.name;
	var sum = ko.computed(function (){
		var result = 0;
				
		ko.utils.arrayForEach( logs(), function (log) {
			result += log.hours;
		});
		return result;
	});
	
	return {
		logs: logs,
		id: id,
		color: color,
		name: name,
		sum: sum
	};
};

var issuesViewModel = function(){
	
	var chart = $('#container').highcharts();
	var date = ko.observable(moment().format('YYYY-MM-DD'));
	var query = ko.observable('');
	var projectId = ko.observable(''); 	// store the latest project id filtered, used when only one project is selected for adding times entries
	var projectComment = ko.observable('');
	var issues = ko.observableArray();
	var forceVisibleProjectsDummy = ko.observable();
	var deferredAddingProjectLog = $.Deferred();
	
	var projectActivities = ko.computed(function (){
		var mappedActivities = [];
		
		jQuery.each(activities, function(id, value) {
			var activityVM = activityViewModel(value);
			mappedActivities.push(activityVM);
			
		});<commit_msg>adjust default date selected<commit_after>/* global apiKey */
/* global redmineBaseUri */
/* global $ */
var activityViewModel = function (data){
	var logs = ko.observableArray();
	var id = data.id;
	var color = data.color;
	var name = data.name;
	var sum = ko.computed(function (){
		var result = 0;
				
		ko.utils.arrayForEach( logs(), function (log) {
			result += log.hours;
		});
		return result;
	});
	
	return {
		logs: logs,
		id: id,
		color: color,
		name: name,
		sum: sum
	};
};

var issuesViewModel = function(){
	
	var chart = $('#container').highcharts();
	
	// 80% of time, times log are done the next day. 20% time for friday are done on monday.
	var bestDate = moment().isoWeekday() == 1 ? moment().subtract(3, "days") : moment().subtract(1, "days");  
	var date = ko.observable(bestDate.format('YYYY-MM-DD'));
	
	var query = ko.observable('');
	var projectId = ko.observable(''); 	// store the latest project id filtered, used when only one project is selected for adding times entries
	var projectComment = ko.observable('');
	var issues = ko.observableArray();
	var forceVisibleProjectsDummy = ko.observable();
	var deferredAddingProjectLog = $.Deferred();
	
	var projectActivities = ko.computed(function (){
		var mappedActivities = [];
		
		jQuery.each(activities, function(id, value) {
			var activityVM = activityViewModel(value);
			mappedActivities.push(activityVM);
			
		});
{'fraction_non_alphanumeric': 0.1458896179081436, 'fraction_numerical': 0.0034735623311462757, 'mean_word_length': 3.890566037735849, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '763120', 'n_tokens_mistral': 899, 'n_tokens_neox': 805, 'n_words': 235}