diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 6102160b3..c0322e0cb 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -124,6 +124,7 @@ class AccountController < ApplicationController when '1' #register_by_email_activation(@user) unless @user.new_record? + flash[:notice] = l(:notice_account_register_done) render action: 'email_valid', locals: {:mail => user.mail} end when '3' diff --git a/app/helpers/account_helper.rb b/app/helpers/account_helper.rb index 3be096492..8ef2d6095 100644 --- a/app/helpers/account_helper.rb +++ b/app/helpers/account_helper.rb @@ -24,7 +24,7 @@ module AccountHelper if user.save and token.save UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0) Mailer.register(token).deliver - flash[:notice] = l(:notice_account_register_done) + #flash[:notice] = l(:notice_account_register_done) #render action: 'email_valid', locals: {:mail => user.mail} else yield if block_given? diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index acd8793cb..bb36f3cb3 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -1,6 +1,7 @@ class CoursesService include ApplicationHelper include CoursesHelper + #TODO:尚未整合权限系统 #参数school_id为0或不传时返回所有课程,否则返回对应学校的课程 #参数per_page_count分页功能,每页显示的课程数 #参数page分页功能,当前页码 @@ -48,7 +49,7 @@ class CoursesService url_to_avatar(obj) end - #课程老师或课程学生列表 + #课程老师或课程学生列表 TODO:更新业务逻辑,当前版本未包含分班功能 def course_teacher_or_student_list params,course,current_user if course.is_a?(Course) c = course @@ -82,6 +83,11 @@ class CoursesService scope = @course ? @course.news.course_visible : News.course_visible end + #显示课程通知 + def show_course_news + + end + def show_course params course = Course.find(params[:id]) course @@ -186,4 +192,17 @@ class CoursesService [@state,course] end + #作业列表 + #已提交的作业数量获取 bid.homeworks.count + #学生提问数量获取 bid.commit.nil? ? 0 : bid.commit + def homework_list params,current_user + if @course.is_public != 0 || current_user.member_of_course?(@course) + @offset, @limit = api_offset_and_limit({:limit => 10}) + @bids = @course.homeworks.order('deadline DESC') + @bids = @bids.like(params[:name]) if params[:name].present? + else + raise '403' + end + end + end \ No newline at end of file