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) =>
|
||||
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'
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
}
|
Loading…
Reference in a new issue