Skip to content

Commit

Permalink
fix(test): Properly distinct tags
Browse files Browse the repository at this point in the history
  • Loading branch information
drikusroor committed Jun 11, 2024
1 parent d8e0f23 commit 3568a98
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def test_validate_invalid_tags(self):
"Albania 2018 - Eugent Bushpepa,Mall,7.046,45.0,ToontjeHoger4Absolute/audio-5.mp3,c,5\n"
"Albania 2018 - Eugent Bushpepa,Mall,7.046,45.0,ToontjeHoger4Absolute/audio-6.mp3,d,6\n"
)
playlist = PlaylistModel.objects.create(name='TestToontjeHoger4Absolute')
playlist = PlaylistModel.objects.create(name='TestToontjeHoger4AbsoluteInvalidTags')
playlist.csv = csv_data
playlist.update_sections()

Expand Down
7 changes: 6 additions & 1 deletion backend/experiment/rules/toontjehoger_4_absolute.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,12 @@ def validate_playlist(self, playlist: Playlist):
errors += self.validate_playlist_groups(groups)

# Check if the tags are 'a', 'b' or 'c'
tags = list(playlist.section_set.values_list('tag', flat=True).distinct())
tags = list(
playlist.section_set
.values_list('tag', flat=True)
.distinct()
.order_by('tag')
)

if tags != ['a', 'b', 'c']:
errors.append("Tags in playlist sections should be 'a', 'b' or 'c'. This playlist has tags: {}".format(tags))
Expand Down

0 comments on commit 3568a98

Please sign in to comment.