import { Queries } from 'marty'
import MoviesConstants from '../constants/movies'
import { yts } from '../utils/request'

class MoviesQueries extends Queries {

  getPage (from: number, limit: number) {
    var page = Math.ceil((from + limit) / limit)

    this.dispatch(MoviesConstants.RECIEVE_YTS_PAGE_STARTING, page)

    return yts(`/v2/list_movies.json?sort_by=peers&limit=${limit}&page=${page}`)
      .then((res) => this.dispatch(MoviesConstants.RECIEVE_YTS_PAGE, page, res.body))
      .catch((err) => this.dispatch(MoviesConstants.RECIEVE_YTS_PAGE_FAILED, page, err))
  }

}

export default MoviesQueries

import { Queries } from 'marty'
import MoviesConstants from '../constants/movies'
import { yts } from '../utils/request'

class MoviesQueries extends Queries {

  getPage (from: number, limit: number) {
    var page = Math.floor((from + limit) / limit)

    this.dispatch(MoviesConstants.RECIEVE_YTS_PAGE_STARTING, page)

    return yts(`/v2/list_movies.json?sort_by=peers&limit=${limit}&page=${page}`)
      .then((res) => this.dispatch(MoviesConstants.RECIEVE_YTS_PAGE, page, res.body))
      .catch((err) => this.dispatch(MoviesConstants.RECIEVE_YTS_PAGE_FAILED, page, err))
  }

}

export default MoviesQueries

--- 
+++ 
@@ -5,7 +5,7 @@
 class MoviesQueries extends Queries {
 
   getPage (from: number, limit: number) {
-    var page = Math.floor((from + limit) / limit)
+    var page = Math.ceil((from + limit) / limit)
 
     this.dispatch(MoviesConstants.RECIEVE_YTS_PAGE_STARTING, page)
 
Make movie page queries start on 1 correctly