Added debug info what on ticket has changed.

This commit is contained in:
Martin Edenhofer 2013-03-08 08:27:25 +01:00
parent 5bcab031c0
commit 417657e9c8
3 changed files with 19 additions and 1 deletions

View file

@ -48,6 +48,8 @@ class Index extends App.Controller
success: (data, status, xhr) =>
if @dataLastCall
return if _.isEqual( @dataLastCall.ticket, data.ticket)
diff = difference( @dataLastCall.ticket, data.ticket )
console.log('diff', diff)
if $('[name="body"]').val()
App.Event.trigger 'notify', {
type: 'success'

View file

@ -103,7 +103,6 @@
var separator2 = posfix.match(/^\s/) ? '' : ' ';
var finalFight = val + separator2 + posfix;
console.log('222', finalFight)
this.setText(finalFight);
this.$element.setCursorPosition(val.length + 1);
};

View file

@ -46,4 +46,21 @@ function escapeRegExp(str) {
Date.prototype.getWeek = function() {
var onejan = new Date(this.getFullYear(),0,1);
return Math.ceil((((this - onejan) / 86400000) + onejan.getDay()+1)/7);
}
function difference(object1, object2) {
var changes = {};
for ( var name in object1 ) {
if ( name in object2 ) {
if ( _.isObject( object2[name] ) && !_.isArray( object2[name] ) ) {
var diff = difference( object1[name], object2[name] );
if ( !_.isEmpty( diff ) ) {
changes[name] = diff;
}
} else if ( !_.isEqual( object1[name], object2[name] ) ) {
changes[name] = object2[name];
}
}
}
return changes;
}