SpeciesFileGroup/taxonworks

View on GitHub
app/javascript/vue/tasks/dwca_import/helpers/pages.js

Summary

Maintainability
A
0 mins
Test Coverage
const createEmptyPages = (pagination) => {
  const perPage = pagination.perPage
  const recordsCount = pagination.total
  const pagesCount = Math.ceil(recordsCount / perPage)
  return Array.from({ length: pagesCount }, (_, i) => {
    return { count: Math.min(perPage, recordsCount - i * perPage), downloaded: false }
  })
}

export {
  createEmptyPages
}