[frontend] Tags for tasks are now categories and managed by the Task Dispenser#855
Conversation
anthonygego
left a comment
There was a problem hiding this comment.
In order to keep categories usable in the submission queries, all the task dispenser should provide categorization. So it should be part of the task_dispenser interface.
anthonygego
left a comment
There was a problem hiding this comment.
This was probably ambitious to divide concepts and refactor one of them in one PR. There are still some mixups to fix to cleanups to be done.
| def get_categories(self): | ||
| """ Returns the tags id associated to the task """ | ||
| return [category for category in self._categories if category in self._course.get_tags()] | ||
| #def get_categories(self): |
There was a problem hiding this comment.
You can remove this code I guess
| {{ t.get_name(user_manager.session_language()) }} | ||
| </li> | ||
| {% endif %} | ||
| {% for tag in course.get_task_dispenser().get_all_categories() %} |
There was a problem hiding this comment.
In this PR categories are taken away from the tag concept. It's worth renaming the "tag" filter to "category" filter in the UI to avoid any confusion.
| {% set ns.tags_ok_counter = ns.tags_ok_counter + 1 %} | ||
| {% set ns.list_tags_ok = ns.list_tags_ok + tag.get_name(user_manager.session_language()) %} | ||
| {% endif %} | ||
| {% for tag in course.get_task_dispenser().get_categories(task.get_id()) %} |
There was a problem hiding this comment.
Here we talk about tags and not categories. You can probably keep the old code and iterate on course_tags.
| {% if tag.get_type() in [0, 2] and tag.is_visible_for_student() %} | ||
| <option value="{{ tag.get_id() }}">{{ tag.get_name(user_manager.session_language()) }}</option> | ||
| {% endif %} | ||
| {% for tag in tag_filter_list %} |
There was a problem hiding this comment.
rename tag => category here.
| {% if tag.is_visible_for_student() or user_manager.has_staff_rights_on_course(course) %} | ||
| <div id="tag" data-tag-name="{{tag.get_id()}}"></div> | ||
| {% endif %} | ||
| {% for tag in course.get_task_dispenser().get_categories(task.get_id()) %} |
There was a problem hiding this comment.
rename tag => category here.
| eval_submission=eval_submission, user_task=user_task, | ||
| previous_taskid=previous_taskid, next_taskid=next_taskid, | ||
| webterm_link=self.webterm_link, input_random_list=random_input_list, | ||
| visible_tags=visible_tags, pdict=pdict, is_input_list=is_input_list) |
There was a problem hiding this comment.
This should actually be kept, it is moreover still used in the template.
| tasks_data=tasks_data, | ||
| grade=course_grade, | ||
| tag_filter_list=tag_list) | ||
| tag_filter_list=categories) |
There was a problem hiding this comment.
rename tag filter to category filter.
|
LGTM |
No description provided.