diff --git a/htdocs/js/AchievementList/achievementlist.js b/htdocs/js/AchievementList/achievementlist.js index 707393170e..646fdd147f 100644 --- a/htdocs/js/AchievementList/achievementlist.js +++ b/htdocs/js/AchievementList/achievementlist.js @@ -65,17 +65,12 @@ const filter_text = document.getElementById('filter_text'); const filter_category = document.getElementById('filter_category'); if (filter === 'selected' && !is_achievement_selected()) { - e.preventDefault(); e.stopPropagation(); show_errors(['select_achievement_err_msg'], [filter_select]); } else if (filter === 'match_ids' && filter_text?.value === '') { e.preventDefault(); e.stopPropagation(); show_errors(['filter_text_err_msg'], [filter_select, filter_text]); - } else if (filter === 'match_category' && filter_category?.value === '') { - e.preventDefault(); - e.stopPropagation(); - show_errors(['filter_category_err_msg'], [filter_select, filter_category]); } } else if (['edit', 'assign', 'export', 'score'].includes(action)) { const action_select = document.getElementById(`${action}_select`); diff --git a/lib/WeBWorK/DB.pm b/lib/WeBWorK/DB.pm index 4d59f2504c..2528e16cbc 100644 --- a/lib/WeBWorK/DB.pm +++ b/lib/WeBWorK/DB.pm @@ -1290,6 +1290,11 @@ sub getAchievements { return $self->{achievement}->gets(map { [$_] } @achievementIDs); } +sub getAchievementCategories { + my ($self) = shift->checkArgs(\@_); + return sort map {@$_} $self->{achievement}->get_fields_where("DISTINCT category"); +} + sub addAchievement { my ($self, $Achievement) = shift->checkArgs(\@_, qw/REC:achievement/); diff --git a/templates/ContentGenerator/Instructor/AchievementList/filter_form.html.ep b/templates/ContentGenerator/Instructor/AchievementList/filter_form.html.ep index c4234f0309..f4537464f8 100644 --- a/templates/ContentGenerator/Instructor/AchievementList/filter_form.html.ep +++ b/templates/ContentGenerator/Instructor/AchievementList/filter_form.html.ep @@ -27,17 +27,17 @@