From b0a63821b975dd431f71c49c359ad40e7fe760ec Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Mon, 24 Feb 2020 11:49:40 +0100 Subject: [PATCH] feeder: use category_id to map formdef's category to primary key (#40111) --- wcs_olap/feeder.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wcs_olap/feeder.py b/wcs_olap/feeder.py index c81b29f..c12e4e5 100644 --- a/wcs_olap/feeder.py +++ b/wcs_olap/feeder.py @@ -429,8 +429,9 @@ CREATE TABLE public.dates AS (SELECT # categories tmp_cat_map = self.create_labeled_table( - 'category', enumerate(c.title for c in self.categories), comment='catégorie') - self.categories_mapping = dict((c.slug, tmp_cat_map[c.title]) for c in self.categories) + 'category', enumerate(c.title for c in self.categories if c.title), comment='catégorie') + self.categories_mapping = dict((f.schema.category_id, tmp_cat_map[f.schema.category]) + for f in self.formdefs if f.schema.category_id) self.create_labeled_table('hour', zip(range(0, 24), map(str, range(0, 24))), comment='heures') -- 2.24.0