<commit_before>Template.day.helpers

	today: -> 'today' if @date == parseInt(moment(new Date).format('YYYYDDDD'))

	view: (a) ->
		if a?
			if FlowRouter.getQueryParam('weekId')?
				a == 'editShifts'
			else
				a == FlowRouter.getQueryParam('view')
		else if FlowRouter.getQueryParam('weekId')?
			'editShifts'
		else
			FlowRouter.getQueryParam('view') || 'showNames'

Template.day.events

	'click #addShift': (e) ->
		projectId = FlowRouter.getParam('projectId')
		tagId = FlowRouter.getQueryParam('tagId') || FlowRouter.getQueryParam('showTags').split(',')[0]
		tagName = ''
		date = $(e.target).closest('.day-wrapper').attr('date')
		day = $(e.target).closest('.day-wrapper').attr('day')
		start = $(e.target).closest('.add-shift').prev('.separator').prev('.shift').attr('end') || 1000
		weekId = FlowRouter.getQueryParam('weekId')
		project = Projects.findOne projectId, fields: tags: 1

		if project?
			for tag in project.tags
				if tag._id == tagId
					tagName = tag.name

			if date?
				Meteor.call 'addShift', projectId, tagId, tagName, parseInt(date), parseInt(start), (e, shiftId) ->
					if !e && shiftId
						wrs -> FlowRouter.setQueryParams editShift: shiftId
			else if weekId?
				Meteor.call 'addTemplateShift', projectId, weekId, tagId, tagName, day, (e, shiftId) ->
					if !e && shiftId
						wrs -> FlowRouter.setQueryParams editShift: shiftId
			else
				throw new Meteor.Error 500, 'Not enough data provided'

	'click #removeAll': (e) ->
		shifts = @shifts

		swalYesNo
			swal: 'delete.allShifts'
			doConfirm: ->
				for shift in shifts
					Meteor.call 'removeShift', shift, handleError
<commit_msg>remove immediate opening of editShift modal after creating a shift #15<commit_after>Template.day.helpers

	today: -> 'today' if @date == parseInt(moment(new Date).format('YYYYDDDD'))

	view: (a) ->
		if a?
			if FlowRouter.getQueryParam('weekId')?
				a == 'editShifts'
			else
				a == FlowRouter.getQueryParam('view')
		else if FlowRouter.getQueryParam('weekId')?
			'editShifts'
		else
			FlowRouter.getQueryParam('view') || 'showNames'

Template.day.events

	'click #addShift': (e) ->
		projectId = FlowRouter.getParam('projectId')
		tagId = FlowRouter.getQueryParam('tagId') || FlowRouter.getQueryParam('showTags').split(',')[0]
		tagName = ''
		date = $(e.target).closest('.day-wrapper').attr('date')
		day = $(e.target).closest('.day-wrapper').attr('day')
		start = $(e.target).closest('.add-shift').prev('.separator').prev('.shift').attr('end') || 1000
		weekId = FlowRouter.getQueryParam('weekId')
		project = Projects.findOne projectId, fields: tags: 1

		if project?
			for tag in project.tags when tag._id == tagId
				tagName = tag.name

			if date?
				Meteor.call 'addShift', projectId, tagId, tagName, parseInt(date), parseInt(start), handleError
			else if weekId?
				Meteor.call 'addTemplateShift', projectId, weekId, tagId, tagName, day, handleError
			else
				throw new Meteor.Error 500, 'Not enough data provided'

	'click #removeAll': (e) ->
		shifts = @shifts

		swalYesNo
			swal: 'delete.allShifts'
			doConfirm: ->
				for shift in shifts
					Meteor.call 'removeShift', shift, handleError

{'fraction_non_alphanumeric': 0.15714285714285714, 'fraction_numerical': 0.006349206349206349, 'mean_word_length': 4.017515923566879, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '5430316', 'n_tokens_mistral': 1230, 'n_tokens_neox': 1046, 'n_words': 242}