diff --git a/src/app/core/models/db/accounting-export.model.ts b/src/app/core/models/db/accounting-export.model.ts index 23374630a..27ea46d88 100644 --- a/src/app/core/models/db/accounting-export.model.ts +++ b/src/app/core/models/db/accounting-export.model.ts @@ -48,8 +48,8 @@ export interface AccountingExport { } export type AccountingExportGetParam = { - type__in: string[], - status__in: string[], + type__in?: string[], + status__in: string[] | string, id__in?: number[], limit: number, offset: number, diff --git a/src/app/core/services/common/accounting-export.service.ts b/src/app/core/services/common/accounting-export.service.ts index 43dc216ef..c970bd684 100644 --- a/src/app/core/services/common/accounting-export.service.ts +++ b/src/app/core/services/common/accounting-export.service.ts @@ -72,6 +72,10 @@ export class AccountingExportService { } if (appName === AppName.QBD_DIRECT) { + if (apiParams.status__in?.includes(AccountingExportStatus.FAILED)) { + apiParams.status__in = AccountingExportStatus.ERROR; + } + delete apiParams.type__in; return this.apiService.get(`/workspaces/${this.workspaceId}/export_logs/`, apiParams); } return this.apiService.get(`/workspaces/${this.workspaceId}/accounting_exports/`, apiParams); diff --git a/src/app/core/services/common/dashboard.service.ts b/src/app/core/services/common/dashboard.service.ts index ccdc341be..737047b40 100644 --- a/src/app/core/services/common/dashboard.service.ts +++ b/src/app/core/services/common/dashboard.service.ts @@ -36,10 +36,10 @@ export class DashboardService { return this.apiService.post(url, {}); } - getExportErrors(version?: string | 'v1'): Observable { + getExportErrors(version?: string | 'v1', appName?: string): Observable { if (version === 'v1') { return this.apiService.get(`/v2/workspaces/${this.workspaceId}/errors/`, {is_resolved: false}); - } else if (version === AppName.QBD_DIRECT) { + } else if (appName === AppName.QBD_DIRECT) { return this.apiService.get(`/workspaces/${this.workspaceId}/export_logs/errors/`, {is_resolved: false}); } @@ -63,7 +63,7 @@ export class DashboardService { } if (taskType) { - const typeKey = appName===AppName.INTACCT ? 'task_type' : 'type__in'; + const typeKey = appName === AppName.INTACCT ? 'task_type' : 'type__in'; apiParams[typeKey] = taskType; } diff --git a/src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.html b/src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.html index f7058cbe2..932742dcc 100644 --- a/src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.html +++ b/src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.html @@ -29,7 +29,6 @@ diff --git a/src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.ts b/src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.ts index cd145013b..05028d825 100644 --- a/src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.ts +++ b/src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.ts @@ -56,8 +56,6 @@ export class QbdDirectDashboardComponent implements OnInit { getAccountingExportSummary$: Observable = this.accountingExportService.getAccountingExportSummary(AppName.QBD_DIRECT); - accountingExportType: QbdDirectTaskLogType[] = [QbdDirectTaskLogType.BILL, QbdDirectTaskLogType.CREDIT_CARD_PURCHASE, QbdDirectTaskLogType.JOURNAL_ENTRY]; - exportLogProcessingStates: TaskLogState[] = [TaskLogState.IN_PROGRESS, TaskLogState.ENQUEUED, TaskLogState.EXPORT_PROCESSED]; isImportItemsEnabled: boolean; @@ -97,7 +95,7 @@ export class QbdDirectDashboardComponent implements OnInit { private pollExportStatus(exportableAccountingExportIds: number[] = []): void { interval(3000).pipe( - switchMap(() => from(this.dashboardService.getAllTasks([], exportableAccountingExportIds, this.accountingExportType, AppName.QBD_DIRECT))), + switchMap(() => from(this.dashboardService.getAllTasks([], exportableAccountingExportIds, [], AppName.QBD_DIRECT))), takeWhile((response: QbdDirectTaskResponse) => response.results.filter(task => (this.exportLogProcessingStates.includes(task.status)) @@ -120,7 +118,7 @@ export class QbdDirectDashboardComponent implements OnInit { this.accountingExportSummary = AccountingExportSummaryModel.parseAPIResponseToAccountingSummaryForQbdDirect(responses[1]); this.failedExpenseGroupCount = res.results.filter(task => task.status === TaskLogState.FAILED || task.status === TaskLogState.FATAL).length; - this.exportableAccountingExportIds = res.results.filter(task => task.status === TaskLogState.FAILED || task.status === TaskLogState.FATAL).map(taskLog => taskLog.expense_group); + this.exportableAccountingExportIds = res.results.filter(task => task.status === TaskLogState.FAILED || task.status === TaskLogState.FATAL).map(taskLog => taskLog.id); this.isExportInProgress = false; this.exportProgressPercentage = 0; @@ -134,7 +132,7 @@ export class QbdDirectDashboardComponent implements OnInit { forkJoin([ this.getExportErrors$, this.getAccountingExportSummary$.pipe(catchError(() => of(null))), - this.dashboardService.getAllTasks(this.exportLogProcessingStates.concat(TaskLogState.ERROR), undefined, this.accountingExportType, AppName.QBD_DIRECT), + this.dashboardService.getAllTasks(this.exportLogProcessingStates.concat(TaskLogState.ERROR), undefined, [], AppName.QBD_DIRECT), this.dashboardService.getExportableAccountingExportIds('v2'), this.QbdDirectExportSettingsService.getQbdExportSettings(), this.importSettingService.getImportSettings() diff --git a/src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.ts b/src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.ts index d2353cffc..cbdb133e1 100644 --- a/src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.ts +++ b/src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.ts @@ -210,7 +210,7 @@ export class DashboardErrorSectionComponent implements OnInit { } handleResolvedMappingStat(): void { - this.dashboardService.getExportErrors(this.errorsVersion).subscribe((errors) => { + this.dashboardService.getExportErrors(this.errorsVersion, this.appName).subscribe((errors) => { const argument = this.errorsVersion === 'v1' ? errors : (errors as ErrorResponse).results; const newError: AccountingGroupedErrors = this.formatErrors(argument);