<commit_before>angular
  .module('confRegistrationWebApp')
  .service('paymentReportService', function PaymentReportService(
    $cacheFactory,
    $rootScope,
    $http,
    $q,
  ) {
    const path = function(id) {
      return 'conferences/' + (id || '') + '/payments/report';
    };

    function getReportData(url) {
      const defer = $q.defer();
      $rootScope.loadingMsg = 'Loading Details';
      $http
        .get(url)
        .then(function(response) {
          var report = response.data;
          defer.resolve(report);
        })
        .catch(function(error) {
          defer.reject(error);
        })
        .finally(function() {
          $rootScope.loadingMsg = '';
        });
      return defer.promise;
    }

    this.getAll = function(id) {
      var allReportsUrl = path(id);
      return getReportData(allReportsUrl);
    };

    this.getReport = function(conferenceId, queryParameters) {
      var defer = $q.defer();
      $rootScope.loadingMsg = 'Loading Payment Report';

      let report = queryParameters.currentReportId
        ? queryParameters.currentReportId
        : 'new';
      $http
        .get(path(conferenceId) + '/' + report, {
          params: queryParameters,
        })
        .then(function(response) {
          $rootScope.loadingMsg = '';
          defer.resolve(response.data);
        })
        .catch(function() {
          $rootScope.loadingMsg = '';
          defer.reject();
        });

      return defer.promise;
    };

    this.collectExcludedIds = function(excludedIdsMap) {
      return Object.keys(excludedIdsMap).filter(k => excludedIdsMap[k]);
    };

    this.queryParamForExcludedPayments = function(excludedIdsMap) {
      let excludedIds = this.collectExcludedIds(excludedIdsMap);
      return excludedIds.length > 0
        ? 'excludedPaymentsIds=' + excludedIds.join('&excludedPaymentsIds=')
        : '';
    };

    this.lockReport = function(conferenceId, excludedIdsMap) {
      var defer = $q.defer();
      let queryParamForExcludedPayments = this.queryParamForExcludedPayments(
        excludedIdsMap,
      );
      $http
        .post(
          path(conferenceId) +
            '/lock' +
            (queryParamForExcludedPayments
              ? '?' + queryParamForExcludedPayments
              : ''),
          {},
        )
        .then(function(response) {
          $rootScope.loadingMsg = '';
          defer.resolve(response.data);
        })
        .catch(function() {
          $rootScope.loadingMsg = '';
          defer.reject();
        });

      return defer.promise;
    };
  });<commit_msg>EVENT-642: Generate Cash and check deposit report Web: code review fixes<commit_after>angular
  .module('confRegistrationWebApp')
  .service('paymentReportService', function PaymentReportService(
    $cacheFactory,
    $rootScope,
    $http,
    $q,
  ) {
    const path = function(id) {
      return 'conferences/' + (id || '') + '/payments/report';
    };

    function getReportData(url) {
      const defer = $q.defer();
      $rootScope.loadingMsg = 'Loading Details';
      $http
        .get(url)
        .then(function(response) {
          var report = response.data;
          defer.resolve(report);
        })
        .catch(function(error) {
          defer.reject(error);
        })
        .finally(function() {
          $rootScope.loadingMsg = '';
        });
      return defer.promise;
    }

    this.getAll = function(id) {
      var allReportsUrl = path(id);
      return getReportData(allReportsUrl);
    };

    this.getReport = function(conferenceId, queryParameters) {
      var defer = $q.defer();
      $rootScope.loadingMsg = 'Loading Payment Report';

      let report = queryParameters.currentReportId
        ? queryParameters.currentReportId
        : 'new';
      $http
        .get(path(conferenceId) + '/' + report, {
          params: queryParameters,
        })
        .then(function(response) {
          $rootScope.loadingMsg = '';
          defer.resolve(response.data);
        })
        .catch(function() {
          $rootScope.loadingMsg = '';
          defer.reject();
        });

      return defer.promise;
    };

    this.collectExcludedIds = function(excludedIdsMap) {
      return Object.keys(excludedIdsMap).filter(k => excludedIdsMap[k]);
    };

    this.queryParamForExcludedPayments = function(excludedIdsMap) {
      let excludedIds = this.collectExcludedIds(excludedIdsMap);
      return excludedIds.length > 0
        ? 'excludedPaymentsIds=' + excludedIds.join('&excludedPaymentsIds=')
        : '';
    };

    this.lockReport = function(conferenceId, excludedIdsMap) {
      var defer = $q.defer();
      let queryParamForExcludedPayments = this.queryParamForExcludedPayments(
        excludedIdsMap,
      );
      $http
        .post(
          `${path(conferenceId)}/lock${
            queryParamForExcludedPayments
              ? '?' + queryParamForExcludedPayments
              : ''
          }`,
          {},
        )
        .then(function(response) {
          $rootScope.loadingMsg = '';
          defer.resolve(response.data);
        })
        .catch(function() {
          $rootScope.loadingMsg = '';
          defer.reject();
        });

      return defer.promise;
    };
  });
{'fraction_non_alphanumeric': 0.12896486229819562, 'fraction_numerical': 0.000949667616334283, 'mean_word_length': 2.086752637749121, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '242833', 'n_tokens_mistral': 1537, 'n_tokens_neox': 1492, 'n_words': 231}