summaryrefslogtreecommitdiffstats
path: root/js/service
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2016-04-12 22:15:58 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2016-04-12 22:16:13 +0200
commitd0401257f666ad8cbda054c5e7ec46524a832636 (patch)
treea055045ea4b20e9a4e6b7b1082d4905d0a9459f4 /js/service
parent3df007e7c04f19562f02a6dc0a6a20bb624c7338 (diff)
Fix #465
Diffstat (limited to 'js/service')
-rw-r--r--js/service/ItemResource.js10
-rw-r--r--js/service/Resource.js2
2 files changed, 10 insertions, 2 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);
}
};
diff --git a/js/service/Resource.js b/js/service/Resource.js
index c2633c83e..4a4a61d42 100644
--- a/js/service/Resource.js
+++ b/js/service/Resource.js
@@ -62,7 +62,7 @@ app.factory('Resource', function () {
if (deleteAtIndex !== undefined) {
this.values.splice(deleteAtIndex, 1);
}
-
+
if (this.hashMap[id] !== undefined) {
delete this.hashMap[id];
}