summaryrefslogtreecommitdiffstats
path: root/js/service/ItemResource.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/service/ItemResource.js')
-rw-r--r--js/service/ItemResource.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/js/service/ItemResource.js b/js/service/ItemResource.js
index 0f15a21c5..167efd5f3 100644
--- a/js/service/ItemResource.js
+++ b/js/service/ItemResource.js
@@ -23,6 +23,7 @@ app.factory('ItemResource', function (Resource, $http, BASE_URL,
this.starredCount = 0;
this.lowestId = 0;
this.highestId = 0;
+ this.fingerprints = {};
Resource.prototype.clear.call(this);
};
@@ -39,6 +40,7 @@ app.factory('ItemResource', function (Resource, $http, BASE_URL,
default:
var self = this;
+ var importValues = [];
value.forEach(function (item) {
// initialize lowest and highest id
if (self.lowestId === 0) {
@@ -54,9 +56,15 @@ app.factory('ItemResource', function (Resource, $http, BASE_URL,
if (item.id < self.lowestId) {
self.lowestId = item.id;
}
+
+ // filter out duplicates
+ if (self.fingerprints[item.fingerprint] === undefined) {
+ self.fingerprints[item.fingerprint] = true;
+ importValues.push(item);
+ }
});
- Resource.prototype.receive.call(this, value, channel);
+ Resource.prototype.receive.call(this, importValues, channel);
}
};