Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions app/controllers/admin/certification/ysws_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def index
end
end
if params.key?(:sort)
sort = params[:sort].presence_in(%w[length todo])
sort = params[:sort].presence_in(%w[length todo age])
if sort
filters["sort"] = sort
filters["dir"] = params[:dir] == "asc" ? "asc" : "desc"
Expand All @@ -39,7 +39,7 @@ def index
session[FILTER_SESSION_KEY] = filters

@project_type = filters["project_type"].presence
@sort = filters["sort"].presence_in(%w[length todo])
@sort = filters["sort"].presence_in(%w[length todo age])
@dir = filters["dir"] == "asc" ? "asc" : "desc"
@with_integrity = filters["with_integrity"] != "0"

Expand All @@ -64,7 +64,8 @@ def index
scope =
case @sort
when "length" then scope.order(Arel.sql("certification_ysws_reviews.original_minutes #{@dir}"))
when "todo" then scope.order(Arel.sql("todo_devlog_count #{@dir}"))
when "todo" then scope.order(Arel.sql("todo_devlog_count #{@dir}"))
when "age" then scope.order(Arel.sql("certification_ysws_reviews.created_at #{@dir}"))
else scope.order(created_at: default_dir)
end

Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/certification/ysws/_queue_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<th>User</th>
<th><%= ysws_sort_link("length", "Length (hours)") %></th>
<th><%= ysws_sort_link("todo", "Todo reviews") %></th>
<th>Age</th>
<th><%= ysws_sort_link("age", "Age") %></th>
<th>Actions</th>
</tr>
</thead>
Expand Down