<commit_before>jsio('from shared.javascript import Class, bind')
jsio('import fan.ui.lists.List')
jsio('import fan.time')

exports = Class(fan.ui.lists.List, function(supr){
	
	this._className += ' CalendarList'
	
	this.init = function() {
		supr(this, 'init', [bind(this, '_makeCell')])
		this._groupsById = {}
		this._groupByLabel = []
	}
	
	// Make isTomorrow isOld isToday methods - map them to groups
	
	this.addGroup = function(label) {
		var el = this._create({ className: 'group', html: '&nbsp;', parent: this.getElement() })
		this._groupByLabel[label] = el
		return this
	}
	
	this._addItem = function(itemId) {
		this._items.push(itemId)
		fin.observe(itemId, 'date', bind(this, '_onDateChange', itemId));
		return itemId
	}
	
	this._onDateChange = function(itemId, op, timestamp) {
		fan.time.getDayOffset(timestamp, bind(this, '_onDayOffset', itemId))
	}
	
	this._onDayOffset = function(itemId, dayOffset) {
		var group, 
			groups = this._groupByLabel,
			cell = this._cells[itemId]
		
		console.log('_onDayOffset', dayOffset, dayOffset == 0, !dayOffset)
		if (dayOffset == 0) { group = groups['Today'] }
		else if (!dayOffset) { group = groups['Unscheduled'] }
		else if (dayOffset < 0) { group = groups['Overdue'] }
		else if (dayOffset == 1) { group = groups['Tomorrow'] }
		else if (dayOffset >= 2) { group = groups['Even later'] }
		
		group.appendChild(cell)
	}
	
	this._makeCell = function(itemId) {
		var cell = this._create({ className: 'cell' }),
			template = '<div class="title">(( Value title ))</div>'
		
		cell.delegateId = itemId
		cell.appendChild(fin.applyTemplate(template, itemId))
		return cell
	}
})<commit_msg>Remove log statement<commit_after>jsio('from shared.javascript import Class, bind')
jsio('import fan.ui.lists.List')
jsio('import fan.time')

exports = Class(fan.ui.lists.List, function(supr){
	
	this._className += ' CalendarList'
	
	this.init = function() {
		supr(this, 'init', [bind(this, '_makeCell')])
		this._groupsById = {}
		this._groupByLabel = []
	}
	
	// Make isTomorrow isOld isToday methods - map them to groups
	
	this.addGroup = function(label) {
		var el = this._create({ className: 'group', html: '&nbsp;', parent: this.getElement() })
		this._groupByLabel[label] = el
		return this
	}
	
	this._addItem = function(itemId) {
		this._items.push(itemId)
		fin.observe(itemId, 'date', bind(this, '_onDateChange', itemId));
		return itemId
	}
	
	this._onDateChange = function(itemId, op, timestamp) {
		fan.time.getDayOffset(timestamp, bind(this, '_onDayOffset', itemId))
	}
	
	this._onDayOffset = function(itemId, dayOffset) {
		var group, 
			groups = this._groupByLabel,
			cell = this._cells[itemId]
		
		if (dayOffset == 0) { group = groups['Today'] }
		else if (!dayOffset) { group = groups['Unscheduled'] }
		else if (dayOffset < 0) { group = groups['Overdue'] }
		else if (dayOffset == 1) { group = groups['Tomorrow'] }
		else if (dayOffset >= 2) { group = groups['Even later'] }
		
		group.appendChild(cell)
	}
	
	this._makeCell = function(itemId) {
		var cell = this._create({ className: 'cell' }),
			template = '<div class="title">(( Value title ))</div>'
		
		cell.delegateId = itemId
		cell.appendChild(fin.applyTemplate(template, itemId))
		return cell
	}
})
{'fraction_non_alphanumeric': 0.15872524752475248, 'fraction_numerical': 0.0027846534653465345, 'mean_word_length': 4.197749196141479, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '5258744', 'n_tokens_mistral': 1196, 'n_tokens_neox': 1075, 'n_words': 251}