*I'm going to answer this from a non-UX perspective this time (because I'm not sure if this belongs here). Your idea is good it might even work provided you do the math right*

First of all, you need to understand and establish this fact, **Popularity =/= Rating (in terms of value)**. A content could have 1 view and a rating of 5/5 or 1000 views and a rating of 1/5. This is because not everyone who views ends up voting. This means, if you are going to mix popularity & rating values in your sorting algorithm you need to set some threshold values (I've explained this below)

**Why your current approach won't work**

Lets do a little experiment on MS Excel to see if your current approach of sorting by rating first then by popularity would work for your 'case'

![MS Excel demo Screenshot][1]

Was this your expected / desired result? I hope not - when you sort items using 2 very different parameters, you are and will be, forced to execute the actions one after the other. Parallel processing is not possible in your case.


**How to approach your problem for a possible/plausible solution**

You need to take into account both popularity (number of views) and rating (average number based on votes by viewers as approval or like or even dislike), and come up with a mathematical expression using both that gives you a new value. You can do this empirically or locate one by doing a little research.

**Example:**
My term for the new value is "hotness" and my formula to calculate this is
`H = (V * Votes) * 100 / views`, where V is how much I value a 'vote' (you can make this variable depending on category etc or keep it a constant). Remember this

Have a look at this table, it should give you a clear idea. I hope this answer helps.

![enter image description here][2]


  [1]: https://i.sstatic.net/9DYuB.jpg
  [2]: https://i.sstatic.net/ZUKXp.jpg