gitlab-org--gitlab-foss/app/helpers/sorting_helper.rb
Dmitriy Zaporozhets 5500f9159f Merge branch 'group-issues-sorting' into 'master'
Improve performance of getting issues on group level

For testing I used the URL http://localhost:3000/groups/gitlab-org/issues?milestone_title=8.1. Prior to these changes said URL would take about 10-12 seconds to load. By applying these changes the loading time has been reduced to roughly 2-3 seconds. 

There's still some stuff going on in some views that I have to look at, resolving those changes might reduce the loading time a bit more. I also still have to check if I didn't break too many tests.

Fixes: gitlab-org/gitlab-ce#3707 gitlab-org/gitlab-ce#4071 

See merge request !2318
2016-01-11 15:28:41 +00:00

96 lines
1.8 KiB
Ruby

module SortingHelper
def sort_options_hash
{
sort_value_name => sort_title_name,
sort_value_recently_updated => sort_title_recently_updated,
sort_value_oldest_updated => sort_title_oldest_updated,
sort_value_recently_created => sort_title_recently_created,
sort_value_oldest_created => sort_title_oldest_created,
sort_value_milestone_soon => sort_title_milestone_soon,
sort_value_milestone_later => sort_title_milestone_later,
sort_value_largest_repo => sort_title_largest_repo,
sort_value_recently_signin => sort_title_recently_signin,
sort_value_oldest_signin => sort_title_oldest_signin,
}
end
def sort_title_oldest_updated
'Oldest updated'
end
def sort_title_recently_updated
'Last updated'
end
def sort_title_oldest_created
'Oldest created'
end
def sort_title_recently_created
'Last created'
end
def sort_title_milestone_soon
'Milestone due soon'
end
def sort_title_milestone_later
'Milestone due later'
end
def sort_title_name
'Name'
end
def sort_title_largest_repo
'Largest repository'
end
def sort_title_recently_signin
'Recent sign in'
end
def sort_title_oldest_signin
'Oldest sign in'
end
def sort_value_oldest_updated
'updated_asc'
end
def sort_value_recently_updated
'updated_desc'
end
def sort_value_oldest_created
'id_asc'
end
def sort_value_recently_created
'id_desc'
end
def sort_value_milestone_soon
'milestone_due_asc'
end
def sort_value_milestone_later
'milestone_due_desc'
end
def sort_value_name
'name_asc'
end
def sort_value_largest_repo
'repository_size_desc'
end
def sort_value_recently_signin
'recent_sign_in'
end
def sort_value_oldest_signin
'oldest_sign_in'
end
end