个人主页

This commit is contained in:
daiao 2016-12-16 15:32:30 +08:00
parent c42fd235e8
commit 27597cf6ed
2 changed files with 12 additions and 4 deletions

View File

@ -1994,7 +1994,11 @@ class UsersController < ApplicationController
exercise_users = ExerciseUser.where("user_id = #{@user.id} and exercise_id in #{exercise_ids}")
finished_test_ids = exercise_users.blank? ? "(-1)" : "(" + exercise_users.map{|eu| eu.exercise_id }.join(",") + ")"
@unfinished_test = Exercise.where("course_id in #{my_course_ids} and exercise_status = 2 and id not in #{finished_test_ids}")
@unfinished_test_count = @unfinished_test.count
@limit = 20
@unfinished_test_pages = Paginator.new @unfinished_test_count, @limit, params['page'] || 1
@offset ||= @unfinished_test_pages.offset
@unfinished_test = paginateHelper @unfinished_test, @limit
respond_to do |format|
format.js
end

View File

@ -14,7 +14,7 @@
<tr>
<th>
<li class="homepageTabTitle">
<%= link_to ut.exercise_name.to_s, "", :target => "_blank", :class => "homepageTabTitle fl ml5" %>
<%= link_to ut.exercise_name.to_s, exercise_index_path(:course_id => ut.course_id), :target => "_blank", :class => "homepageTabTitle fl ml5" %>
</li>
</th>
<th>
@ -24,7 +24,11 @@
</th>
<th>
<li class="homepageTabAuthor ml5" >
<%= ut.time %>
<% if ut.time.to_i == -1 %>
不限时
<% else %>
<%= ut.time %>
<% end %>
</li>
</th>
<th>
@ -43,7 +47,7 @@
</tbody>
</table>
<ul class="pages" style="width: auto;display: table;margin-left: auto;margin-right: auto; padding-top: 10px">
<%#= pagination_links_full @unfinished_homework_pages, @unfinished_homeworks_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
<%= pagination_links_full @unfinished_test_pages, @unfinished_test_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
</ul>
</div>
</div>