@ -149,7 +149,7 @@ class Competitions::CompetitionTeamsController < Competitions::BaseController
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()')
.select('sum(compelete_status !=0 ) as finish, count(*) as total')
.select('sum(compelete_status >0 ) as finish, count(*) as total')
.having('total != 0 and finish >= (total / 2)').to_sql
@ -160,7 +160,7 @@ class Competitions::CompetitionTeamsController < Competitions::BaseController
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()')
.select('sum(compelete_status !=0 ) as finish, count(*) as total')
.select('sum(compelete_status >0 ) as finish, count(*) as total')
.having('total != 0 and finish >= (total / 2)').to_sql
percentage_sql=StudentWork.where('homework_common_id = homework_commons.id and homework_commons.publish_time is not null and homework_commons.publish_time < ?',end_time)
.select('sum(compelete_status !=0 ) as finish, count(*) as total')
.select('sum(compelete_status >0 ) as finish, count(*) as total')
.having('total != 0 and finish >= (total / 2)').to_sql
percentage_sql=StudentWork.where('homework_common_id = homework_commons.id and homework_commons.publish_time is not null and homework_commons.publish_time < ?',end_time)
.select('sum(compelete_status !=0 ) as finish, count(*) as total')
.select('sum(compelete_status >0 ) as finish, count(*) as total')
.having('total != 0 and finish >= (total / 2)').to_sql