Skip to content

Commit

Permalink
refactor: use taxonomy.export_id in header
Browse files Browse the repository at this point in the history
  • Loading branch information
rpenido committed Feb 9, 2024
1 parent 5245264 commit c82e9cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1818,7 +1818,7 @@ def test_export_course(self, user_attr) -> None:
assert response.headers['Content-Type'] == 'text/csv'

expected_csv = (
'"Name","Type","ID","Taxonomy 1","Taxonomy 2"\r\n'
'"Name","Type","ID","1-taxonomy-1","2-taxonomy-2"\r\n'
'"Test Course","course","course-v1:orgA+test_course+test_run","Tag 1.1",""\r\n'
'" test sequential","sequential","block-v1:orgA+test_course+test_run+type@sequential+block@test_'
'sequential","Tag 1.1, Tag 1.2","Tag 2.1"\r\n'
Expand Down
3 changes: 1 addition & 2 deletions openedx/core/djangoapps/content_tagging/rest_api/v1/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ def _generate_csv_rows() -> Iterator[str]:

# Prepare the header for the taxonomies
for taxonomy_id, taxonomy in taxonomies.items():
# ToDo: change to taxonomy.external_id after the external_id is implemented
header[f"taxonomy_{taxonomy_id}"] = taxonomy.name
header[f"taxonomy_{taxonomy_id}"] = taxonomy.export_id

csv_writer = csv.DictWriter(pseudo_buffer, fieldnames=header.keys(), quoting=csv.QUOTE_NONNUMERIC)
yield csv_writer.writerow(header)
Expand Down

0 comments on commit c82e9cb

Please sign in to comment.