Skip to content
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

Add dynamic counts to search filters #5471

Merged
merged 80 commits into from
Nov 13, 2024
Merged
Changes from 1 commit
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
cc610d6
Remove color function
jorg-vr Apr 4, 2024
810fa47
Remove paramval function
jorg-vr Apr 4, 2024
84872dc
Pass through filter collection objects
jorg-vr Apr 4, 2024
0447296
Revert "Pass through filter collection objects"
jorg-vr Apr 4, 2024
b7a03dc
create flecible count by filters
jorg-vr Apr 5, 2024
bf8764c
Return named filter info
jorg-vr Apr 5, 2024
6f71249
Replace autoinclude by class method
jorg-vr Apr 5, 2024
ab642b6
Make filter options available in controller
jorg-vr Apr 5, 2024
fb772c4
Display counts
jorg-vr Apr 18, 2024
a51f6c2
Add support for multi filters
jorg-vr Apr 19, 2024
8beadd3
Fix bug
jorg-vr Apr 19, 2024
b7dfa43
fix non standerdize name options
jorg-vr Apr 19, 2024
95138fe
Create custom count functions
jorg-vr Apr 19, 2024
befc03a
Simplify js
jorg-vr Apr 19, 2024
f37d232
Autoupdate
jorg-vr Apr 19, 2024
4e7e410
Fix translations
jorg-vr Apr 19, 2024
8dde4f7
Add disabeled state to filters
jorg-vr Apr 19, 2024
b11b565
Convert activity read states
jorg-vr Apr 19, 2024
5293075
Rename by id filters
jorg-vr Apr 22, 2024
3459c41
Merge branch 'main' into chore/simplify-search
jorg-vr Apr 22, 2024
46acf6f
Fix filters for questions
jorg-vr Apr 23, 2024
f39264f
Fix course member search
jorg-vr Apr 23, 2024
60c073c
Fix course
jorg-vr Apr 23, 2024
2e3ebcc
Fix course
jorg-vr Apr 23, 2024
8792545
Fix course label filters
jorg-vr Apr 29, 2024
62a16f8
Fix course labels filters for evaluations
jorg-vr Apr 30, 2024
57110bb
Fix event types
jorg-vr Apr 30, 2024
457f928
COnvert feedbacks searchbar
jorg-vr Apr 30, 2024
8fa9e88
Fix repository searchbars
jorg-vr Apr 30, 2024
7030d61
Fix saved annotations
jorg-vr Apr 30, 2024
bebda0f
Fix series
jorg-vr Apr 30, 2024
3d2e327
Fix submissions
jorg-vr Apr 30, 2024
8d92875
fix users
jorg-vr Apr 30, 2024
f07a7d3
Simplify enums
jorg-vr Apr 30, 2024
2c80ae8
Simplify model naming
jorg-vr Apr 30, 2024
f9be4c9
remove unused code
jorg-vr May 2, 2024
98bdf22
Always include hasfilter
jorg-vr May 2, 2024
2d22ea1
Always include filterable
jorg-vr May 2, 2024
559b800
Fix javascript tests
jorg-vr May 2, 2024
0d95942
Merge branch 'chore/simplify-search' of github.com:dodona-edu/dodona …
jorg-vr May 2, 2024
d413a4a
Revert "Always include hasfilter"
jorg-vr May 2, 2024
16763ba
Fix rails tests
jorg-vr May 2, 2024
609dcec
Fix linting
jorg-vr May 2, 2024
f2215c4
Move color responsibility to frontend
jorg-vr May 2, 2024
7e581df
Simply xourse controller scoresheet
jorg-vr May 2, 2024
deb9809
Fix linting
jorg-vr May 2, 2024
a0cde25
Add count to searchfield suggestions
jorg-vr May 2, 2024
4a5c754
Remove unused scope
jorg-vr May 2, 2024
fae53bd
Remove unused scope
jorg-vr May 2, 2024
c40bbdc
Merge branch 'main' into chore/simplify-search
jorg-vr May 13, 2024
f7b5ec8
Avoid string repeat in type
jorg-vr May 13, 2024
e9e0887
Add documentation
jorg-vr May 13, 2024
e89c14a
Make numbers less prominent
jorg-vr May 13, 2024
9f054c6
Remove inline style
jorg-vr May 13, 2024
ff66570
Remove inline sql
jorg-vr May 14, 2024
698b7b9
Only do reselect on group by clauses
jorg-vr May 14, 2024
632fdde
Remove counts for submissions table
jorg-vr May 14, 2024
edd9fca
Fix course filter on all courses page
jorg-vr May 14, 2024
b934156
Add clear all active filters link
jorg-vr May 16, 2024
da4d108
Calculate question filter options after everything filter
jorg-vr May 16, 2024
726a1d6
Update app/controllers/feedbacks_controller.rb
jorg-vr May 22, 2024
174fc2a
Move filterable by course labels to its own concern
jorg-vr May 22, 2024
adf67d8
Only include filterable when needed
jorg-vr May 22, 2024
1a69157
Fix imports
jorg-vr May 22, 2024
77d6f3f
Merge branch 'main' into chore/simplify-search
jorg-vr May 22, 2024
f78d162
Hide 'define_singleton_method' behind method
jorg-vr May 22, 2024
0e89451
Remove delegation
jorg-vr May 22, 2024
8e2ce0b
Don't modify parent
jorg-vr May 22, 2024
b8171b2
Fix rubocop
jorg-vr May 22, 2024
14528ea
Merge branch 'main' into chore/simplify-search
jorg-vr May 28, 2024
9d872d8
No need for extra keys
jorg-vr May 28, 2024
25930a7
Merge branch 'main' into chore/simplify-search
jorg-vr Jun 25, 2024
21dd7dd
Merge branch 'main' into chore/simplify-search
jorg-vr Nov 13, 2024
4c0adbc
Fix linting
jorg-vr Nov 13, 2024
52025b1
Merge branch 'main' into chore/simplify-search
jorg-vr Nov 13, 2024
1f11ba3
Fix tests
jorg-vr Nov 13, 2024
a5c64f2
Use json_escape
jorg-vr Nov 13, 2024
e7a4ac7
Remove unused translations key
jorg-vr Nov 13, 2024
0c2bc88
Remove unused filter statement
jorg-vr Nov 13, 2024
2c4b3cf
Rename consistency
jorg-vr Nov 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix non standerdize name options
jorg-vr committed Apr 19, 2024
commit b7dfa430d017b97159119dcb72d2d2a81df113be
9 changes: 2 additions & 7 deletions app/controllers/activities_controller.rb
Original file line number Diff line number Diff line change
@@ -19,14 +19,14 @@ class ActivitiesController < ApplicationController
protect_from_forgery except: %i[media input_service_worker]

has_scope :by_filter, as: 'filter'
has_scope :in_repository, as: 'repository_id'
has_scope :by_description_languages, as: 'description_languages', type: :array
has_scope :by_popularities, as: 'popularity', type: :array
has_scope :is_draft, as: 'draft'
has_filter :programming_language, 'red'
has_filter :type, 'deep-purple'
has_filter :judge, 'red'
has_filter :labels, 'purple', multi: true
has_filter :repository, 'blue-gray'
has_filter :draft, 'indigo'

has_scope :repository_scope, as: 'tab' do |controller, scope, value|
course = Series.find(controller.params[:id]).course if controller.params[:id]
@@ -69,11 +69,6 @@ def index
policy_scope(Activity).order_by_popularity(:DESC)
end

if params[:repository_id]
@repository = Repository.find(params[:repository_id])
@activities = @activities.in_repository(@repository)
end

unless @activities.empty?
@filters = filters(@activities)
@activities = apply_scopes(@activities)
5 changes: 2 additions & 3 deletions app/models/activity.rb
Original file line number Diff line number Diff line change
@@ -73,8 +73,6 @@ class Activity < ApplicationRecord
scope :content_pages, -> { where(type: ContentPage.name) }
scope :exercises, -> { where(type: Exercise.name) }

scope :in_repository, ->(repository) { where repository: repository }

scope :by_name, ->(name) { where('name_nl LIKE ? OR name_en LIKE ? OR path LIKE ?', "%#{name}%", "%#{name}%", "%#{name}%") }
search_by :name_nl, :name_en, :path
filterable_by :status, value_check: ->(value) { value.in? statuses }
@@ -83,7 +81,8 @@ class Activity < ApplicationRecord
filterable_by :type, name_hash: ->(value) { { Exercise.name => Exercise.model_name.human, ContentPage.name => ContentPage.model_name.human } }
filterable_by :judge, column: 'judge_id', name_hash: ->(values) { Judge.where(id: values).to_h { |j| [j.id, j.name] } }
filterable_by :labels, multi: true, associations: :labels, column: 'labels.name'
scope :is_draft, ->(value = true) { where(draft: value) }
filterable_by :repository, column: 'repository_id', name_hash: ->(values) { Repository.where(id: values).to_h { |r| [r.id, r.name] } }
filterable_by :draft, name_hash: ->(values) { { true => I18n.t('activities.index.filters.draft'), false => I18n.t('activities.index.filters.not_draft') } }
scope :by_description_languages, lambda { |languages|
by_language = all # allow chaining of scopes
by_language = by_language.where(description_en_present: true) if languages.include? 'en'