Commit 3b154331 authored by okhin's avatar okhin 🚴

The tag part was broken, it now correctly get distinct and non empty tags, creating all of them

parent c88a161b
Pipeline #2547 passed with stages
in 2 minutes and 53 seconds
...@@ -40,14 +40,14 @@ class Command(BaseCommand): ...@@ -40,14 +40,14 @@ class Command(BaseCommand):
c = db.cursor(DictCursor) c = db.cursor(DictCursor)
# First, let's get the data from presse table. # First, let's get the data from presse table.
# We're also grouping a lot of queries # We're also grouping a lot of queries
presse = c.execute("""SELECT *, nr.body as body, GROUP_CONCAT(t.name, ',') as tags presse = c.execute("""SELECT *, nr.body as body, GROUP_CONCAT(DISTINCT t.name) as tags
FROM presse p FROM presse p
JOIN node n JOIN node n
ON n.nid = p.nid ON n.nid = p.nid
JOIN node_revisions nr JOIN node_revisions nr
ON nr.vid = n.vid ON nr.vid = n.vid
JOIN term_node tn JOIN term_node tn
ON tn.nid = p.nid ON tn.vid = n.vid
JOIN term_data t JOIN term_data t
ON t.tid = tn.tid ON t.tid = tn.tid
GROUP BY n.nid""") GROUP BY n.nid""")
...@@ -81,7 +81,7 @@ class Command(BaseCommand): ...@@ -81,7 +81,7 @@ class Command(BaseCommand):
article.refresh_from_db() article.refresh_from_db()
# Insert tags # Insert tags
article.tags.add(item['tags'].lower()) article.tags.set(*item['tags'].lower().split(','))
# Publish or draft as needed # Publish or draft as needed
if item['published'] >= 1: if item['published'] >= 1:
# Let's get the extracts # Let's get the extracts
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment