分组作业添加成员后再次打开,数据未保存
This commit is contained in:
parent
254e1f44f6
commit
c50d307e89
|
@ -1115,6 +1115,20 @@ class StudentWorkController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_user_infor
|
||||||
|
req = Hash.new(false)
|
||||||
|
user = User.where("id = #{params[:user_id].to_i}").first
|
||||||
|
if user
|
||||||
|
req[:id] = user.id
|
||||||
|
req[:name] = user.show_name
|
||||||
|
req[:student_id] = user.user_extensions.student_id
|
||||||
|
req[:valid] = true
|
||||||
|
else
|
||||||
|
req[:valid] = false
|
||||||
|
end
|
||||||
|
render :json => req
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def searchstudent_by_name users, name
|
def searchstudent_by_name users, name
|
||||||
mems = []
|
mems = []
|
||||||
|
|
|
@ -105,6 +105,31 @@
|
||||||
$("#choose_students_list").append(link);
|
$("#choose_students_list").append(link);
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
var ids = $("#group_member_ids").val().split(',');
|
||||||
|
if (ids.length > 1){
|
||||||
|
for(var i=1; i<ids.length; i++) {
|
||||||
|
$.get(
|
||||||
|
'/student_work/get_user_infor',
|
||||||
|
{
|
||||||
|
user_id: ids[i]
|
||||||
|
},
|
||||||
|
function (data) {
|
||||||
|
if (data.valid) {
|
||||||
|
var link = "<li id='choose_student_"+data.id+"' onclick='delete_student("+data.id+");'>"+data.name;
|
||||||
|
if (data.student_id != "" ) {
|
||||||
|
link += "("+data.student_id+")";
|
||||||
|
}
|
||||||
|
link += "</li>";
|
||||||
|
$("#choose_students_list").append(link);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<% end %>
|
<% end %>
|
|
@ -7,7 +7,8 @@ $("#all_students_list").empty();
|
||||||
link += "</li>";
|
link += "</li>";
|
||||||
$("#all_students_list").append(link);
|
$("#all_students_list").append(link);
|
||||||
|
|
||||||
var str = "";
|
var str = $("#group_member_ids").val();
|
||||||
|
/*var str = "";
|
||||||
var lists = $("#choose_students_list li");
|
var lists = $("#choose_students_list li");
|
||||||
if(lists.length > 0) {
|
if(lists.length > 0) {
|
||||||
for(var i=0; i<lists.length; i++) {
|
for(var i=0; i<lists.length; i++) {
|
||||||
|
@ -17,7 +18,7 @@ $("#all_students_list").empty();
|
||||||
str += ",";
|
str += ",";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
<% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? && user.member_of_course?(@course) %>
|
<% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? && user.member_of_course?(@course) %>
|
||||||
if (str.indexOf(<%=user.id.to_s %>) < 0) {
|
if (str.indexOf(<%=user.id.to_s %>) < 0) {
|
||||||
$("#student_<%=user.id %>").one("click",function choose_student() {
|
$("#student_<%=user.id %>").one("click",function choose_student() {
|
||||||
|
|
|
@ -329,6 +329,7 @@ RedmineApp::Application.routes.draw do
|
||||||
post 'last_codecomparetime'
|
post 'last_codecomparetime'
|
||||||
post 'set_score_rule'
|
post 'set_score_rule'
|
||||||
get 'work_canrepeat'
|
get 'work_canrepeat'
|
||||||
|
get 'get_user_infor'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue