update properly

This commit is contained in:
Anton Dyudin 2015-08-20 17:20:48 -07:00
parent 447d15667c
commit c1cd51bbb8
2 changed files with 8 additions and 3 deletions

View File

@ -1338,12 +1338,16 @@ WorkStore = assign({}, EventEmitter.prototype, {
return this.removeListener("change", cb);
},
getData: function(arg) {
var _tasks, i, id, len, sort, tasks;
var _tasks, got, i, id, j, len, sort, tasks;
sort = arg.sort, tasks = arg.tasks;
_tasks = _.clone(tasks);
for (i = 0, len = _list.length; i < len; i++) {
for (i = j = 0, len = _list.length; j < len; i = ++j) {
id = _list[i].id;
if (!(got = _tasks[id])) {
continue;
}
delete _tasks[id];
_list[i] = this.itemFromData(got, i);
}
return sort.map((function(_this) {
return function(k, index) {

View File

@ -70,8 +70,9 @@ WorkStore = assign {},EventEmitter.prototype,{
getData: ({sort,tasks})->
_tasks = _.clone tasks
for {id} in _list
for {id},i in _list when got = _tasks[id]
delete _tasks[id]
_list[i] = @itemFromData got,i
sort.map (k,index)=>
if _tasks[k]
@newItem {item:_tasks[k],index}