-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/thk playlists #1099
Fix/thk playlists #1099
Conversation
🔍 Existing Issues For ReviewYour pull request is modifying functions with the following pre-existing issues: 📄 File: backend/experiment/rules/toontjehoger_2_preverbal.py
Did you find this useful? React with a 👍 or 👎 |
@@ -199,15 +199,16 @@ def validate_playlist_groups(self, groups): | |||
# Check if the groups are sequential and unique | |||
integer_groups.sort() | |||
if integer_groups != list(range(1, len(groups) + 1)): | |||
return ['Groups in playlist sections should be sequential numbers starting from 1 to the number of sections in the playlist ({}). E.g. "1, 2, 3, ... {}"'.format(len(groups), len(groups))] | |||
return ['Groups in playlist sections should be sequential numbers starting from 1 to the number of items in the playlist ({}). E.g. "1, 2, 3, ... {}"'.format(self.PLAYLIST_ITEMS, self.PLAYLIST_ITEMS)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the original Toontjehoger Absolute game has 13 playlist items, this validator should be flexible: it should be entirely possible to implement ToontjeHoger Absolute with less playlist items, without having to override the validator.
I thought this validator should be flexible, or have I misunderstood what you wrote? 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a misunderstanding indeed: with "playlist items" I meant, "items, of which there are three variants". So n_sections != self.PLAYLIST_ITEMS
. Hurrying through code reviews is not a good idea, I should've caught this before.
|
||
return [] | ||
|
||
def validate_playlist(self, playlist: Playlist): | ||
errors = super().validate_playlist(playlist) | ||
|
||
# Get group values from sections, ordered by group | ||
groups = list(playlist.section_set.values_list('group', flat=True)) | ||
groups = list(playlist.section_set.values_list( | ||
'group', flat=True).distinct()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the actual needed change though - before, there were as many groups as there were sections. I still think the reference to PLAYLIST_ITEMS
in the validate_playlist_groups
function is more readable.
This branch fixes remaining issues with playlist validation of Toontjehoger rules files.
It also implements a much simplified strategy for picking sections and giving feedback in
ToontjeHogerKids5Tempo
.