<commit_before>import { settingsHelper } from './SettingsHelper';
import { disputeHelper } from './DisputeHelper';
import {backChainUtil} from  './BackChainUtil';
import {dbconnectionManager} from './DBConnectionManager';
import moment from 'moment'


class DisputeOrganizerTaskHelper {

    disputeOrganizerTask() {
        console.log("Deleting old disputes && getting ent address !!");
        settingsHelper.getApplicationSettings()
            .then(result => {
                this.deleteOldDisputes(result);
                this.getEnterpriseAddress(result);
            })
            .catch(err => {
                console.error("submitDisputeWindowVisibleForTnx err: " + err);
                reject(err);
            });
    }

    submitDisputeWindowVisibleForTnx(transaction, settings) {
        return new Promise((resolve, reject) => {
            if (settings && settings.blockChain.disputeSubmissionWindowInMinutes) {
                    let disputeSubmissionWindowInMinutes = settings.blockChain.disputeSubmissionWindowInMinutes;
                    let duration = moment.duration(moment(new Date()).diff(moment(new Date(transaction.date))));
                    let durationInMinutes = Math.ceil(duration.asMinutes());
                    resolve(durationInMinutes > disputeSubmissionWindowInMinutes);
                } else {
                    resolve(true);
                }
        });
    }

    getEnterpriseAddress(settings) {
        if(settings && settings.chainOfCustidy && settings.chainOfCustidy.authenticationToken && settings.chainOfCustidy.chainOfCustodyUrl) {
            fetch(backChainUtil.returnValidURL(settings.chainOfCustidy.chainOfCustodyUrl + '/oms/rest/backchain/v1/addresses'), {
                method: 'get',
                headers: new Headers({
                    'Cache-Control': 'no-cache',
                    'Pragma': 'no-cache',<commit_msg>missed removing<commit_after>import { settingsHelper } from './SettingsHelper';
import { disputeHelper } from './DisputeHelper';
import {backChainUtil} from  './BackChainUtil';
import {dbconnectionManager} from './DBConnectionManager';
import moment from 'moment'


class DisputeOrganizerTaskHelper {

    disputeOrganizerTask() {
        console.log("Deleting old disputes && getting ent address !!");
        settingsHelper.getApplicationSettings()
            .then(result => {
                this.deleteOldDisputes(result);
                this.getEnterpriseAddress(result);
            })
            .catch(err => {
                console.error("submitDisputeWindowVisibleForTnx err: " + err);
            });
    }

    submitDisputeWindowVisibleForTnx(transaction, settings) {
        return new Promise((resolve, reject) => {
            if (settings && settings.blockChain.disputeSubmissionWindowInMinutes) {
                    let disputeSubmissionWindowInMinutes = settings.blockChain.disputeSubmissionWindowInMinutes;
                    let duration = moment.duration(moment(new Date()).diff(moment(new Date(transaction.date))));
                    let durationInMinutes = Math.ceil(duration.asMinutes());
                    resolve(durationInMinutes > disputeSubmissionWindowInMinutes);
                } else {
                    resolve(true);
                }
        });
    }

    getEnterpriseAddress(settings) {
        if(settings && settings.chainOfCustidy && settings.chainOfCustidy.authenticationToken && settings.chainOfCustidy.chainOfCustodyUrl) {
            fetch(backChainUtil.returnValidURL(settings.chainOfCustidy.chainOfCustodyUrl + '/oms/rest/backchain/v1/addresses'), {
                method: 'get',
                headers: new Headers({
                    'Cache-Control': 'no-cache',
                    'Pragma': 'no-cache',
{'fraction_non_alphanumeric': 0.10575139146567718, 'fraction_numerical': 0.0005300821627352239, 'mean_word_length': 2.4092140921409215, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '5550858', 'n_tokens_mistral': 974, 'n_tokens_neox': 938, 'n_words': 155}