@ -367,7 +367,7 @@ class CompetitionTeamsController < ApplicationController
defget_valid_course_count(ids)
defget_valid_course_count(ids)
percentage_sql=StudentWork.where('homework_common_id = homework_commons.id and homework_commons.publish_time is not null and homework_commons.publish_time < NOW()')
percentage_sql=StudentWork.where('homework_common_id = homework_commons.id and homework_commons.publish_time is not null and homework_commons.publish_time < NOW()')
.select('sum(compelete_status !=0 ) as finish, count(*) as total')
.select('sum(compelete_status !=0 ) as finish, count(*) as total')
@ -378,7 +378,7 @@ class CompetitionTeamsController < ApplicationController
defget_valid_shixun_count(ids)
defget_valid_shixun_count(ids)
percentage_sql=StudentWork.where('homework_common_id = homework_commons.id and homework_commons.publish_time is not null and homework_commons.publish_time < NOW()')
percentage_sql=StudentWork.where('homework_common_id = homework_commons.id and homework_commons.publish_time is not null and homework_commons.publish_time < NOW()')
.select('sum(compelete_status !=0 ) as finish, count(*) as total')
.select('sum(compelete_status !=0 ) as finish, count(*) as total')
.having('finish > (total / 2)').to_sql
.having('total != 0 and finish >= (total / 2)').to_sql