FIX 版本库兼容euducoder平台数据

This commit is contained in:
Jasder
2020-10-22 18:00:31 +08:00
parent 1feb238e80
commit 58f8d60646
12 changed files with 240 additions and 111 deletions

View File

@@ -10,10 +10,9 @@ class Projects::ListQuery < ApplicationQuery
end
def call
q = Project.visible.search_project(params[:search])
q = Project.visible.by_name_or_identifier(params[:search])
scope = q.result(distinct: true)
.includes(:project_category, :project_language, :repository, owner: :user_extension)
scope = q
.with_project_type(params[:project_type])
.with_project_category(params[:category_id])
.with_project_language(params[:language_id])
@@ -21,7 +20,9 @@ class Projects::ListQuery < ApplicationQuery
sort = params[:sort_by] || "updated_on"
sort_direction = params[:sort_direction] || "desc"
scope = scope.no_anomory_projects.reorder("projects.#{sort} #{sort_direction}")
scope
custom_sort(scope, sort, sort_direction)
# scope = scope.reorder("projects.#{sort} #{sort_direction}")
# scope
end
end