fixed 项目查询错误

This commit is contained in:
xiaoxiaoqiong 2022-01-05 15:50:31 +08:00
parent 67020b7e73
commit 6c70b680ea
1 changed files with 11 additions and 5 deletions

View File

@ -12,11 +12,17 @@ class Projects::ListQuery < ApplicationQuery
def call
q = Project.visible.by_name_or_identifier(params[:search])
scope = q
.with_project_type(params[:project_type])
.with_project_category(params[:category_id])
.with_project_language(params[:language_id])
if params[:project_type] == 'mirror'
scope = q
.where(project_type: ["sync_mirror","mirror"])
.with_project_category(params[:category_id])
.with_project_language(params[:language_id])
else
scope = q
.with_project_type(params[:project_type])
.with_project_category(params[:category_id])
.with_project_language(params[:language_id])
end
sort = params[:sort_by] || "updated_on"
sort_direction = params[:sort_direction] || "desc"