Skip to content

Commit

Permalink
Fix Warehouse_Features primary key bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
jpnavarro committed Nov 1, 2024
1 parent 4625ecd commit 520fd30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v2.6.1 20241101 JP
- Fix Warehouse_Features primary key bugs

v2.6.0 20241031 JP
- Load CiderFeatures model if CIDER_FEATURES_PATH is set

Expand Down
6 changes: 3 additions & 3 deletions bin/router_cider.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,11 @@ def Warehouse_Features(self, info_json):
self.cur = {} # Feature categories currently in database
self.new = {} # New feature categories in document
for item in CiderFeatures.objects.all():
self.cur[item.id] = item
self.cur[item.feature_category_id] = item
self.logger.debug('Retrieved from database {}/feature categories'.format(len(self.cur)))

for p_feat in info_json['feature_categories']: # Iterating over feature groups
id = p_feat['id']
id = p_feat['feature_category_id']
# All the attributes, then remove the ones that have their own field
other_attributes=p_feat.copy()
for attrib in self.feature_model_fields:
Expand All @@ -433,7 +433,7 @@ def Warehouse_Features(self, info_json):
for id in self.cur:
if id not in self.new:
try:
CiderFeatures.objects.filter(feature_category_id=id).delete()
CiderFeatures.objects.get(pk=id).delete()
self.FCOUNTERS.update({'Delete'})
self.logger.info('Deleted ID={}'.format(id))
except (DataError, IntegrityError) as e:
Expand Down

0 comments on commit 520fd30

Please sign in to comment.