<commit_before>import Ember from 'ember';
import Firebase from 'firebase';

export default Ember.Controller.extend({

	pile: Ember.computed('model', function(){
		return this.get('model.firstObject');
	}),

	// newPile: Ember.computed('model', function(){
	// 	return {
	// 		pile: this.get('model')
	// 	};
	// }),

	// entriesSorting: ['amountOfLikes:desc'],
	entriesSorting: ['initialAmountOfLikes:desc'],
	sortedEntries: Ember.computed.sort('pile.competingEntries', 'entriesSorting'),
	// sortedEntries: Ember.computed('pile.competingEntries', function(){
	// 	return this.get('pile.competingEntries').sortBy('amountOfLikes');
	// }),

	project: Ember.inject.controller('project.index'),

	actions: {
		createPile: function() {
			//Unused code. This is handled at Project.index controller
			this.set('newPile.createdAt', Firebase.ServerValue.TIMESTAMP);
			this.set('newPile.updatedAt', Firebase.ServerValue.TIMESTAMP);
			this.store.createRecord('pile', this.get('newPile')).save();
		},

		pickEntry: function(entry){
			var project = this.get('project.model');
			entry.set('project', project).save(); //added save to test security rules
			//ToDO: close Pile
		},

		likeEntry: function(newLikeData, entry){

			newLikeData.createdAt = Firebase.ServerValue.TIMESTAMP;
			newLikeData.updatedAt = Firebase.ServerValue.TIMESTAMP;
			newLikeData.pile = this.get('pile');
			newLikeData.id = "testId";

			this.store.createRecord('like', newLikeData).save().then(function(){
				entry.save();
			}); //Todo: manage response
			// var likes = entry.get('likes');
			// likes.addObject(newLike);
			// entry.save();
			 //entry needs to be saved instrad of like because of Embedded relationship

			//save()
		},

		unlikeEntry: function(unlikeData, entry){
			unlikeData.destroyRecord().then(function(){
				entry.save();<commit_msg>Entry id is back to normal<commit_after>import Ember from 'ember';
import Firebase from 'firebase';

export default Ember.Controller.extend({

	pile: Ember.computed('model', function(){
		return this.get('model.firstObject');
	}),

	// newPile: Ember.computed('model', function(){
	// 	return {
	// 		pile: this.get('model')
	// 	};
	// }),

	// entriesSorting: ['amountOfLikes:desc'],
	entriesSorting: ['initialAmountOfLikes:desc'],
	sortedEntries: Ember.computed.sort('pile.competingEntries', 'entriesSorting'),
	// sortedEntries: Ember.computed('pile.competingEntries', function(){
	// 	return this.get('pile.competingEntries').sortBy('amountOfLikes');
	// }),

	project: Ember.inject.controller('project.index'),

	actions: {
		createPile: function() {
			//Unused code. This is handled at Project.index controller
			this.set('newPile.createdAt', Firebase.ServerValue.TIMESTAMP);
			this.set('newPile.updatedAt', Firebase.ServerValue.TIMESTAMP);
			this.store.createRecord('pile', this.get('newPile')).save();
		},

		pickEntry: function(entry){
			var project = this.get('project.model');
			entry.set('project', project).save(); //added save to test security rules
			//ToDO: close Pile
		},

		likeEntry: function(newLikeData, entry){

			newLikeData.createdAt = Firebase.ServerValue.TIMESTAMP;
			newLikeData.updatedAt = Firebase.ServerValue.TIMESTAMP;
			newLikeData.pile = this.get('pile');
			// newLikeData.id = "testId";

			this.store.createRecord('like', newLikeData).save().then(function(){
				entry.save();
			}); //Todo: manage response
			// var likes = entry.get('likes');
			// likes.addObject(newLike);
			// entry.save();
			 //entry needs to be saved instrad of like because of Embedded relationship

			//save()
		},

		unlikeEntry: function(unlikeData, entry){
			unlikeData.destroyRecord().then(function(){
				entry.save();
{'fraction_non_alphanumeric': 0.16693766937669377, 'fraction_numerical': 0.0, 'mean_word_length': 4.310791366906475, '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': '5522550', 'n_tokens_mistral': 1319, 'n_tokens_neox': 1178, 'n_words': 222}