Added debug info what on ticket has changed.
This commit is contained in:
parent
5bcab031c0
commit
417657e9c8
3 changed files with 19 additions and 1 deletions
|
@ -48,6 +48,8 @@ class Index extends App.Controller
|
||||||
success: (data, status, xhr) =>
|
success: (data, status, xhr) =>
|
||||||
if @dataLastCall
|
if @dataLastCall
|
||||||
return if _.isEqual( @dataLastCall.ticket, data.ticket)
|
return if _.isEqual( @dataLastCall.ticket, data.ticket)
|
||||||
|
diff = difference( @dataLastCall.ticket, data.ticket )
|
||||||
|
console.log('diff', diff)
|
||||||
if $('[name="body"]').val()
|
if $('[name="body"]').val()
|
||||||
App.Event.trigger 'notify', {
|
App.Event.trigger 'notify', {
|
||||||
type: 'success'
|
type: 'success'
|
||||||
|
|
|
@ -103,7 +103,6 @@
|
||||||
var separator2 = posfix.match(/^\s/) ? '' : ' ';
|
var separator2 = posfix.match(/^\s/) ? '' : ' ';
|
||||||
|
|
||||||
var finalFight = val + separator2 + posfix;
|
var finalFight = val + separator2 + posfix;
|
||||||
console.log('222', finalFight)
|
|
||||||
this.setText(finalFight);
|
this.setText(finalFight);
|
||||||
this.$element.setCursorPosition(val.length + 1);
|
this.$element.setCursorPosition(val.length + 1);
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,3 +47,20 @@ Date.prototype.getWeek = function() {
|
||||||
var onejan = new Date(this.getFullYear(),0,1);
|
var onejan = new Date(this.getFullYear(),0,1);
|
||||||
return Math.ceil((((this - onejan) / 86400000) + onejan.getDay()+1)/7);
|
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;
|
||||||
|
}
|
Loading…
Reference in a new issue