选择实训调整

dev_local
cxt 5 years ago
parent 25eb878fe0
commit 41387c7b82

@ -159,11 +159,11 @@ class ExerciseController < ApplicationController
end
if search.blank?
@shixuns = Shixun.where("shixuns.status = 2 and challenges_count = 1 and shixuns.id not in (#{none_shixun_ids.join(",")})").
@shixuns = Shixun.where("shixuns.status = 2 and challenges_count = 1 and shixuns.id not in (#{none_shixun_ids.join(",")})").uniq.
select{|shixun| shixun.challenges.where(:st => 1).count == 0}
else
@shixuns = Shixun.joins(challenges: :challenge_tags).where("shixuns.status = 2 and challenges_count = 1 and shixuns.id not in (#{none_shixun_ids.join(",")})").
@shixuns = Shixun.joins(challenges: :challenge_tags).where("shixuns.status = 2 and challenges_count = 1 and shixuns.id not in (#{none_shixun_ids.join(",")})").uniq.
where("shixuns.name like ? or challenge_tags.name like ?", "%#{search}%", "%#{search}%").select{|shixun| shixun.challenges.where(:st => 1).count == 0}
end

@ -61,7 +61,7 @@
if (msg_list.height() + msg_list[0].scrollTop >= msg_list[0].scrollHeight - 60) {
msg_list_loading = true;
$.getJSON("<%= choose_shixuns_exercise_path(@exercise) %>?page="+page, function(json) {
$.getJSON("<%= choose_shixuns_exercise_path(@exercise) %>?page="+page+"&search="+$("input[name='search']").val(), function(json) {
if (json) {
msg_list_loading = false;
var str = "";

Loading…
Cancel
Save