{"size": 742, "ext": "js", "max_stars_repo_path": "app/services/helpers/format-dashboard-capacity.js", "max_stars_repo_name": "ministryofjustice/wmt-worker", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/services/helpers/format-dashboard-capacity.js", "max_issues_repo_name": "ministryofjustice/wmt-worker", "max_issues_repo_issues_event_min_datetime": "2017-05-30T13:15:07.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-18T09:10:32.000Z", "max_forks_repo_path": "app/services/helpers/format-dashboard-capacity.js", "max_forks_repo_name": "ministryofjustice/wmt-worker", "max_forks_repo_forks_event_min_datetime": "2021-04-11T06:17:03.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-11T06:17:03.000Z"}
{"max_stars_count": null, "max_issues_count": 34, "max_forks_count": 1, "avg_line_length": 24.7333333333, "max_line_length": 53, "alphanum_fraction": 0.6967654987}
module.exports = function (capacity) {
  const capacityArray = []
  capacity.forEach(function (record) {
    capacityArray.push([
      record.regionName,
      record.lduName,
      record.teamName,
      record.offenderManager,
      record.gradeCode,
      formatCapacityValue(record.capacityPercentage),
      record.availablePoints,
      record.remainingPoints,
      record.contractedHours,
      record.reductionHours,
      record.totalCases,
      record.cmsAdjustmentPoints,
      formatCMSPercentage(record.cmsPercentage)
    ])
  })
  return capacityArray
}

const formatCapacityValue = function (capacity) {
  return (Math.round(capacity)) / 100
}

const formatCMSPercentage = function (cms) {
  return (cms.toFixed(1)) / 100
}
