{"size": 798, "ext": "js", "max_stars_repo_path": "app/services/data/get-duplicate-workload-points-calculations-id.js", "max_stars_repo_name": "uk-gov-mirror/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/data/get-duplicate-workload-points-calculations-id.js", "max_issues_repo_name": "uk-gov-mirror/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/data/get-duplicate-workload-points-calculations-id.js", "max_forks_repo_name": "uk-gov-mirror/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": 53.2, "max_line_length": 101, "alphanum_fraction": 0.7531328321}
const knex = require('../../../knex').appSchema

module.exports = function (workloadOwnerId) {
  return knex('workload_points_calculations')
    .join('workload', 'workload_points_calculations.workload_id', 'workload.id')
    .join('workload_owner', 'workload.workload_owner_id', 'workload_owner.id')
    .join('workload_report', 'workload_points_calculations.workload_report_id', 'workload_report.id')
    .join('team', 'workload_owner.team_id', 'team.id')
    .join('offender_manager', 'workload_owner.offender_manager_id', 'offender_manager.id')
    .join('offender_manager_type', 'offender_manager.type_id', 'offender_manager_type.id')
    .select('workload_points_calculations.id AS wpc_id')
    .whereNull('workload_report.effective_to')
    .andWhere('workload_owner.id', workloadOwnerId)
}
