Merge branch 'develop' of http://repository.trustie.net/xianbo/trustie2 into develop

This commit is contained in:
Gan Yi.ang 2015-11-26 15:55:23 +08:00
commit 0cd954f9ea
6 changed files with 5548 additions and 6 deletions

View File

@ -167,6 +167,12 @@ class StudentWorkController < ApplicationController
end
def create
# 提交作品前先判断是否已经提交
if hsd_committed_work?(User.current.id, @homework.id)
flash[:notice] = l(:notice_successful_create)
redirect_to edit_student_work_url(params[:student_work])
return
end
if params[:student_work]
@submit_result = true
student_work = StudentWork.find(params[:student_work_id]) if params[:student_work_id]
@ -499,6 +505,12 @@ class StudentWorkController < ApplicationController
end
private
def hsd_committed_work?(user, homework)
sw = StudentWork.where("user_id =? and homework_common_id =?", user, homework).first
sw.nil? ? result = false : result = true
result
end
#获取作业
def find_homework
@homework = HomeworkCommon.find params[:homework]

View File

@ -94,4 +94,6 @@ zh:
label_user_name: "用户名称"
#setting end
label_course_poll: 课程问卷
label_course_poll: 课程问卷
label_homework_committed: 你已经提交过作品,如果你想修改作品的话,可以在作品列表页面对作品信息进行修改。

1856
db/schema.rb.BASE.rb Normal file

File diff suppressed because it is too large Load Diff

1862
db/schema.rb.LOCAL.rb Normal file

File diff suppressed because it is too large Load Diff

1810
db/schema.rb.REMOTE.rb Normal file

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@ module Trustie
base.class_eval {
#before_create :add_gitlab_user
#before_destroy :delete_gitlab_user
before_save :change_gitlab_user
#before_save :change_gitlab_user
}
end
@ -22,10 +22,10 @@ module Trustie
def delete_gitlab_user
del_user(self)
end
def change_gitlab_user
change_password(self.gid, self.hashed_password, self.salt)
end
#
#def change_gitlab_user
# change_password(self.gid, self.hashed_password, self.salt)
#end
def g
@g ||= ::Gitlab.client