commit
c7014d63e6
@ -0,0 +1,27 @@
|
|||||||
|
<td><%= course.id %></td>
|
||||||
|
<td class="text-left">
|
||||||
|
<%= link_to(course.name, "/courses/#{course.id}", target: '_blank') %>
|
||||||
|
</td>
|
||||||
|
<td><%= course.course_members_count %></td>
|
||||||
|
<td><%= get_attachment_count(course, 0) %></td>
|
||||||
|
<td><%= course.course_homework_count(1) %></td>
|
||||||
|
<td><%= course.course_homework_count(3) %></td>
|
||||||
|
<td><%= course.course_homework_count(4) %></td>
|
||||||
|
<td><%= course.exercises_count %></td>
|
||||||
|
<td><%= course.evaluate_count %></td>
|
||||||
|
<td><%= course.is_public == 1 ? "--" : "√" %></td>
|
||||||
|
<td><%= course.is_end ? "已结束" : "正在进行" %></td>
|
||||||
|
<td><%= course.school&.name %></td>
|
||||||
|
<td><%= course.teacher&.real_name %></td>
|
||||||
|
<td><%= course.created_at&.strftime('%Y-%m-%d %H:%M') %></td>
|
||||||
|
<td>
|
||||||
|
<%= check_box_tag :homepage_show,!course.homepage_show,course.homepage_show,remote:true,data:{id:course.id},class:"course-setting-form" %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= check_box_tag :email_notify,!course.email_notify,course.email_notify,remote:true,data:{id:course.id},class:"course-setting-form" %>
|
||||||
|
</td>
|
||||||
|
<td class="action-container">
|
||||||
|
<% if course.is_delete == 0 %>
|
||||||
|
<%= delete_link '删除', admins_course_path(course, element: ".course-item-#{course.id}"), class: 'delete-course-action' %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
@ -0,0 +1 @@
|
|||||||
|
$("#course-item-<%= @course.id %>").html("<%= j render partial: "admins/courses/shared/td",locals: {course: @course} %>")
|
@ -0,0 +1 @@
|
|||||||
|
$(".laboratory-item-<%= @laboratory.id %>").html("<%= j render partial: "admins/laboratories/shared/laboratory_item",locals: {laboratory: @laboratory} %>")
|
@ -0,0 +1,6 @@
|
|||||||
|
class AddSyncShixunSubjectToLaboratory < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
add_column :laboratories, :sync_subject, :boolean, default: 0
|
||||||
|
add_column :laboratories, :sync_shixun, :boolean, default: 0
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,17 @@
|
|||||||
|
class AddUniqIndexToExerciseAnswer < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
remove_index :exercise_answers, column: [:exercise_question_id, :user_id]
|
||||||
|
|
||||||
|
change_column_default :exercise_answers, :exercise_choice_id, from: nil, to: -1
|
||||||
|
ExerciseAnswer.where(exercise_choice_id: nil).update_all(exercise_choice_id: -1)
|
||||||
|
|
||||||
|
sql = %Q(delete from exercise_answers where (exercise_question_id, user_id, exercise_choice_id) in
|
||||||
|
(select * from (select exercise_question_id, user_id, exercise_choice_id from exercise_answers group by exercise_question_id, user_id, exercise_choice_id having count(*) > 1) a)
|
||||||
|
and id not in (select * from (select min(id) from exercise_answers group by exercise_question_id, user_id, exercise_choice_id having count(*) > 1 order by id) b))
|
||||||
|
ActiveRecord::Base.connection.execute sql
|
||||||
|
|
||||||
|
add_index :exercise_answers, [:exercise_question_id, :user_id, :exercise_choice_id], name: 'exercise_choice_index', unique: true
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,16 @@
|
|||||||
|
class AddUniqIndexToPollVotes < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
remove_index :poll_votes, column: [:poll_question_id, :user_id]
|
||||||
|
|
||||||
|
change_column_default :poll_votes, :poll_question_id, from: nil, to: -1
|
||||||
|
PollVote.where(poll_answer_id: nil).update_all(poll_answer_id: -1)
|
||||||
|
|
||||||
|
sql = %Q(delete from poll_votes where (poll_question_id, user_id, poll_answer_id) in
|
||||||
|
(select * from (select poll_question_id, user_id, poll_answer_id from poll_votes group by poll_question_id, user_id, poll_answer_id having count(*) > 1) a)
|
||||||
|
and id not in (select * from (select min(id) from poll_votes group by poll_question_id, user_id, poll_answer_id having count(*) > 1 order by id) b))
|
||||||
|
ActiveRecord::Base.connection.execute sql
|
||||||
|
|
||||||
|
add_index :poll_votes, [:poll_question_id, :user_id, :poll_answer_id], name: 'poll_answer_index', unique: true
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
Reference in new issue