修改注册接口、添加作业列表接口
This commit is contained in:
parent
95d8c1a09d
commit
36967eeec0
|
@ -124,6 +124,7 @@ class AccountController < ApplicationController
|
||||||
when '1'
|
when '1'
|
||||||
#register_by_email_activation(@user)
|
#register_by_email_activation(@user)
|
||||||
unless @user.new_record?
|
unless @user.new_record?
|
||||||
|
flash[:notice] = l(:notice_account_register_done)
|
||||||
render action: 'email_valid', locals: {:mail => user.mail}
|
render action: 'email_valid', locals: {:mail => user.mail}
|
||||||
end
|
end
|
||||||
when '3'
|
when '3'
|
||||||
|
|
|
@ -24,7 +24,7 @@ module AccountHelper
|
||||||
if user.save and token.save
|
if user.save and token.save
|
||||||
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
|
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
|
||||||
Mailer.register(token).deliver
|
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}
|
#render action: 'email_valid', locals: {:mail => user.mail}
|
||||||
else
|
else
|
||||||
yield if block_given?
|
yield if block_given?
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
class CoursesService
|
class CoursesService
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
include CoursesHelper
|
include CoursesHelper
|
||||||
|
#TODO:尚未整合权限系统
|
||||||
#参数school_id为0或不传时返回所有课程,否则返回对应学校的课程
|
#参数school_id为0或不传时返回所有课程,否则返回对应学校的课程
|
||||||
#参数per_page_count分页功能,每页显示的课程数
|
#参数per_page_count分页功能,每页显示的课程数
|
||||||
#参数page分页功能,当前页码
|
#参数page分页功能,当前页码
|
||||||
|
@ -48,7 +49,7 @@ class CoursesService
|
||||||
url_to_avatar(obj)
|
url_to_avatar(obj)
|
||||||
end
|
end
|
||||||
|
|
||||||
#课程老师或课程学生列表
|
#课程老师或课程学生列表 TODO:更新业务逻辑,当前版本未包含分班功能
|
||||||
def course_teacher_or_student_list params,course,current_user
|
def course_teacher_or_student_list params,course,current_user
|
||||||
if course.is_a?(Course)
|
if course.is_a?(Course)
|
||||||
c = course
|
c = course
|
||||||
|
@ -82,6 +83,11 @@ class CoursesService
|
||||||
scope = @course ? @course.news.course_visible : News.course_visible
|
scope = @course ? @course.news.course_visible : News.course_visible
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#显示课程通知
|
||||||
|
def show_course_news
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def show_course params
|
def show_course params
|
||||||
course = Course.find(params[:id])
|
course = Course.find(params[:id])
|
||||||
course
|
course
|
||||||
|
@ -186,4 +192,17 @@ class CoursesService
|
||||||
[@state,course]
|
[@state,course]
|
||||||
end
|
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
|
end
|
Loading…
Reference in New Issue