Skip to content

Commit

Permalink
added issue & volume to articles ranking
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Kao committed Nov 22, 2017
1 parent 19b849e commit 5cb98fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/controllers/articles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ def index
@articles = Article
.where("section_id = ?", @section.id)
.joins("LEFT JOIN sections ON articles.id = sections.id")
.order("articles.rank + 3 * sections.rank")
.order("articles.rank + 3 * sections.rank + 12 * articles.issue + 192 * articles.volume")
else
@articles = Article
.joins("LEFT JOIN sections ON articles.id = sections.id")
.order("articles.rank + 3 * sections.rank")
.order("articles.rank + 3 * sections.rank + 12 * articles.issue + 192 * articles.volume")
end

@articles = @articles.order(:created_at).reverse if params[:order_by] == 'date'
Expand Down

0 comments on commit 5cb98fe

Please sign in to comment.