Skip to content

Commit

Permalink
remove manual flag feature code (#3093)
Browse files Browse the repository at this point in the history
  • Loading branch information
sumrender authored Jun 24, 2024
1 parent 706f538 commit e2759eb
Show file tree
Hide file tree
Showing 47 changed files with 78 additions and 909 deletions.
1 change: 0 additions & 1 deletion src/app/core/models/expense.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export interface Expense {
tx_location_column9?: Destination;
tx_locations: Destination[];
tx_mandatory_fields_present: boolean;
tx_manual_flag: boolean;
tx_mileage_calculated_amount?: number;
tx_mileage_calculated_distance?: number;
tx_mileage_is_round_trip?: boolean;
Expand Down
1 change: 0 additions & 1 deletion src/app/core/models/platform/v1/expense.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export interface Expense {
invoice_number?: string;
is_billable: boolean;
is_corporate_card_transaction_auto_matched: boolean;
is_manually_flagged: boolean;
is_policy_flagged: boolean;
is_receipt_mandatory: boolean;
is_reimbursable: boolean;
Expand Down
1 change: 0 additions & 1 deletion src/app/core/models/platform/v1/report.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export interface Report {
num_expenses: number;
is_verified: boolean;
settlement_id: string;
is_manually_flagged: boolean;
is_policy_flagged: boolean;
is_exported: boolean;
last_paid_at: Date;
Expand Down
1 change: 0 additions & 1 deletion src/app/core/models/public-policy-expense.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export interface PublicPolicyExpense {
invoice_number: number;
locations?: Destination[] | string[];
mandatory_fields_present: boolean;
manual_flag: boolean;
mileage_calculated_amount: number;
mileage_calculated_distance: number;
mileage_is_round_trip: boolean;
Expand Down
1 change: 0 additions & 1 deletion src/app/core/models/report-unflattened.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export interface UnflattenedReport {
location4: string;
location5: string;
locations: string[];
manual_flag: boolean;
num_transactions: number;
org_user_id: string;
last_updated_by?: UserDetails;
Expand Down
1 change: 0 additions & 1 deletion src/app/core/models/report-v1.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export interface ReportV1 {
verification_state?: string;
trip_request_id?: string;
exported: boolean;
manual_flag: boolean;
policy_flag: boolean;
claim_number: string;
from_dt: Date;
Expand Down
1 change: 0 additions & 1 deletion src/app/core/models/report.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export interface ExtendedReport {
rp_location4?: string;
rp_location5?: string;
rp_locations: string[];
rp_manual_flag: boolean;
rp_num_transactions: number;
rp_org_user_id: string;
rp_policy_flag: boolean;
Expand Down
1 change: 0 additions & 1 deletion src/app/core/models/unformatted-transaction.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export interface UnformattedTransaction {
invoice_number: number;
locations: [];
mandatory_fields_present: boolean;
manual_flag: boolean;
mileage_calculated_amount: number;
mileage_calculated_distance: number;
mileage_is_round_trip: boolean;
Expand Down
1 change: 0 additions & 1 deletion src/app/core/models/v1/transaction.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export interface Transaction {
invoice_number?: number;
locations?: Destination[] | string[] | { display: string }[];
mandatory_fields_present?: boolean;
manual_flag?: boolean;
mileage_calculated_amount?: number;
mileage_calculated_distance?: number;
mileage_is_round_trip?: boolean;
Expand Down
11 changes: 0 additions & 11 deletions src/app/core/services/launch-darkly.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,6 @@ describe('LaunchDarklyService', () => {
});
});

it('checkIfManualFlaggingFeatureIsEnabled(): should check if manual flagging feature is enabled', (done) => {
spyOn(launchDarklyService, 'getVariation').and.returnValue(of(true));
const key = 'deprecate_manual_flagging';

launchDarklyService.checkIfManualFlaggingFeatureIsEnabled().subscribe((res) => {
expect(res.value).toBeTrue();
expect(launchDarklyService.getVariation).toHaveBeenCalledOnceWith(key, true);
done();
});
});

describe('shutDownClient():', () => {
beforeEach(() => {
ldClient = jasmine.createSpyObj('LDClient', ['off', 'close']);
Expand Down
4 changes: 0 additions & 4 deletions src/app/core/services/launch-darkly.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ export class LaunchDarklyService {
return defaultValue;
}

checkIfManualFlaggingFeatureIsEnabled(): Observable<{ value: boolean }> {
return this.getVariation('deprecate_manual_flagging', true).pipe(map((value) => ({ value })));
}

// Checks if the passed in user is the same as the user which is initialized to LaunchDarkly (if any)
private isTheSameUser(newUser: LDClient.LDUser): boolean {
const previousUser = this.ldClient?.getUser();
Expand Down
6 changes: 3 additions & 3 deletions src/app/core/services/policy.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ describe('PolicyService', () => {

it('checkIfViolationsExist(): should check for policy violations', () => {
spyOn(policyService, 'getPolicyRules').and.returnValue([]);
expect(policyService.checkIfViolationsExist(violations)).toBe(false);
expect(policyService.checkIfViolationsExist(violations)).toBeFalse();
expect(policyService.getPolicyRules).toHaveBeenCalledOnceWith(policyViolationData);
});

Expand All @@ -240,7 +240,7 @@ describe('PolicyService', () => {
};

policyService.prepareEtxnForPolicyCheck(etxn, null).subscribe((res) => {
expect(res.is_matching_ccc_expense).toBe(false);
expect(res.is_matching_ccc_expense).toBeFalse();
done();
});
});
Expand All @@ -252,7 +252,7 @@ describe('PolicyService', () => {
};

policyService.prepareEtxnForPolicyCheck(etxn, eCCCData1.ccce).subscribe((res) => {
expect(res.is_matching_ccc_expense).toBe(true);
expect(res.is_matching_ccc_expense).toBeTrue();
done();
});
});
Expand Down
4 changes: 0 additions & 4 deletions src/app/core/services/tracking.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,6 @@ export class TrackingService {
this.eventTrack('Expense navigation clicked', properties);
}

expenseFlagUnflagClicked(properties: { action: string }): void {
this.eventTrack('Expense flagged or unflagged', properties);
}

expenseRemovedByApprover(properties = {}): void {
this.eventTrack('Expense removed from report by approver', properties);
}
Expand Down
22 changes: 0 additions & 22 deletions src/app/core/services/transaction.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,28 +229,6 @@ describe('TransactionService', () => {
});
});

it('manualFlag(): should manually flag a transaction', (done) => {
const transactionID = 'tx5fBcPBAxLv';
apiService.post.and.returnValue(of(expenseData2));

transactionService.manualFlag(transactionID).subscribe((res) => {
expect(res).toEqual(expenseData2);
expect(apiService.post).toHaveBeenCalledOnceWith('/transactions/' + transactionID + '/manual_flag');
done();
});
});

it('manualUnflag(): should manually unflag a transaction', (done) => {
const transactionID = 'tx5fBcPBAxLv';
apiService.post.and.returnValue(of(expenseData1));

transactionService.manualUnflag(transactionID).subscribe((res) => {
expect(res).toEqual(expenseData1);
expect(apiService.post).toHaveBeenCalledOnceWith('/transactions/' + transactionID + '/manual_unflag');
done();
});
});

it('delete(): should delete a transaction', (done) => {
const transactionID = 'tx5fBcPBAxLv';
apiService.delete.and.returnValue(of(expenseData1));
Expand Down
16 changes: 0 additions & 16 deletions src/app/core/services/transaction.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,6 @@ export class TransactionService {
);
}

@CacheBuster({
cacheBusterNotifier: expensesCacheBuster$,
})
manualFlag(txnId: string): Observable<Expense> {
return this.apiService.post('/transactions/' + txnId + '/manual_flag');
}

@CacheBuster({
cacheBusterNotifier: expensesCacheBuster$,
})
manualUnflag(txnId: string): Observable<Expense> {
return this.apiService.post('/transactions/' + txnId + '/manual_unflag');
}

@Cacheable({
cacheBusterObserver: expensesCacheBuster$,
})
Expand Down Expand Up @@ -812,7 +798,6 @@ export class TransactionService {
mileage_calculated_amount: expense.mileage_calculated_amount,
commute_deduction: expense.commute_deduction,
commute_deduction_id: expense.commute_details_id,
manual_flag: expense.is_manually_flagged,
policy_flag: expense.is_policy_flagged,
extracted_data: expense.extracted_data
? {
Expand Down Expand Up @@ -909,7 +894,6 @@ export class TransactionService {
tx_mileage_is_round_trip: expense.mileage_is_round_trip,
tx_mileage_calculated_distance: expense.mileage_calculated_distance,
tx_mileage_calculated_amount: expense.mileage_calculated_amount,
tx_manual_flag: expense.is_manually_flagged,
tx_policy_flag: expense.is_policy_flagged,
tx_extracted_data: expense.extracted_data
? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export function TestCases1(getTestBed) {

expect(component.fg.value).toEqual(addEditAdvanceRequestFormValueData2);
expect(component.fg.controls.currencyObj.validator).toEqual(component.currencyObjValidator);
expect(component.id).toEqual(undefined);
expect(component.id).toBeUndefined();
expect(component.from).toEqual('TEAM_ADVANCE');
expect(component.advanceActions).toEqual({
can_save: true,
Expand Down
31 changes: 14 additions & 17 deletions src/app/fyle/my-expenses/my-expenses.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -185,23 +185,20 @@
</div>

<ng-container *ngIf="isConnected$|async">
<ng-container *ngIf="(isManualFlagFeatureEnabled$|async) as isManualFlagFeatureEnabled">
<div *ngFor="let expense of myExpenses$ | async as list; let i = index">
<app-expense-card-v2
[expense]="expense"
[previousExpenseTxnDate]="list[i-1]?.spent_at"
[previousExpenseCreatedAt]="list[i-1]?.created_at"
[isSelectionModeEnabled]="selectionMode"
[selectedElements]="selectedElements"
(goToTransaction)="goToTransaction($event)"
(setMultiselectMode)="switchSelectionMode($event)"
(cardClickedForSelection)="selectExpense($event)"
(showCamera)="showCamera($event)"
[isManualFlagFeatureEnabled]="isManualFlagFeatureEnabled.value"
>
</app-expense-card-v2>
</div>
</ng-container>
<div *ngFor="let expense of myExpenses$ | async as list; let i = index">
<app-expense-card-v2
[expense]="expense"
[previousExpenseTxnDate]="list[i-1]?.spent_at"
[previousExpenseCreatedAt]="list[i-1]?.created_at"
[isSelectionModeEnabled]="selectionMode"
[selectedElements]="selectedElements"
(goToTransaction)="goToTransaction($event)"
(setMultiselectMode)="switchSelectionMode($event)"
(cardClickedForSelection)="selectExpense($event)"
(showCamera)="showCamera($event)"
>
</app-expense-card-v2>
</div>
</ng-container>
<ng-container *ngIf="isConnected$|async">
<ng-container *ngIf="isLoadingDataInInfiniteScroll">
Expand Down
16 changes: 0 additions & 16 deletions src/app/fyle/my-expenses/my-expenses.page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ import {
expectedReportsSinglePageWithApproval,
} from 'src/app/core/mock-data/platform-report.data';
import { corporateCardsResponseData } from 'src/app/core/mock-data/corporate-card-response.data';
import { LaunchDarklyService } from 'src/app/core/services/launch-darkly.service';

describe('MyExpensesV2Page', () => {
let component: MyExpensesPage;
Expand Down Expand Up @@ -171,7 +170,6 @@ describe('MyExpensesV2Page', () => {
let sharedExpenseService: jasmine.SpyObj<SharedExpenseService>;
let expensesService: jasmine.SpyObj<ExpensesService>;
let spenderReportsService: jasmine.SpyObj<SpenderReportsService>;
let launchDarklyService: jasmine.SpyObj<LaunchDarklyService>;

beforeEach(waitForAsync(() => {
const tasksServiceSpy = jasmine.createSpyObj('TasksService', ['getReportsTaskCount', 'getExpensesTaskCount']);
Expand Down Expand Up @@ -299,9 +297,6 @@ describe('MyExpensesV2Page', () => {
'restrictPendingTransactionsEnabled',
'doesExpenseHavePendingCardTransaction',
]);
const launchDarklyServiceSpy = jasmine.createSpyObj('LaunchDarklyService', [
'checkIfManualFlaggingFeatureIsEnabled',
]);

TestBed.configureTestingModule({
declarations: [MyExpensesPage, ReportState, MaskNumber],
Expand Down Expand Up @@ -411,7 +406,6 @@ describe('MyExpensesV2Page', () => {
provide: SpenderReportsService,
useValue: spenderReportsServiceSpy,
},
{ provide: LaunchDarklyService, useValue: launchDarklyServiceSpy },
ReportState,
MaskNumber,
],
Expand Down Expand Up @@ -457,7 +451,6 @@ describe('MyExpensesV2Page', () => {
expensesService = TestBed.inject(ExpensesService) as jasmine.SpyObj<ExpensesService>;
sharedExpenseService = TestBed.inject(SharedExpenseService) as jasmine.SpyObj<SharedExpenseService>;
spenderReportsService = TestBed.inject(SpenderReportsService) as jasmine.SpyObj<SpenderReportsService>;
launchDarklyService = TestBed.inject(LaunchDarklyService) as jasmine.SpyObj<LaunchDarklyService>;

component.loadExpenses$ = new BehaviorSubject({});
}));
Expand Down Expand Up @@ -494,7 +487,6 @@ describe('MyExpensesV2Page', () => {
expensesService.getExpenseStats.and.returnValue(of(completeStats));
expensesService.getExpensesCount.and.returnValue(of(10));
expensesService.getExpenses.and.returnValue(of(apiExpenses1));
launchDarklyService.checkIfManualFlaggingFeatureIsEnabled.and.returnValue(of({ value: true }));

spenderReportsService.getAllReportsByParams.and.returnValue(of(expectedReportsSinglePageWithApproval));
spyOn(component, 'doRefresh');
Expand All @@ -507,14 +499,6 @@ describe('MyExpensesV2Page', () => {
inputElement = component.simpleSearchInput.nativeElement;
});

it('should initialize isManualFlagFeatureEnabled', (done) => {
component.ionViewWillEnter();
component.isManualFlagFeatureEnabled$.subscribe((res) => {
expect(res.value).toBeTrue();
done();
});
});

it('should set isNewReportsFlowEnabled, isInstaFyleEnabled, isBulkFyleEnabled, isMileageEnabled and isPerDiemEnabled to true if orgSettings and orgUserSettings properties are enabled', fakeAsync(() => {
component.ionViewWillEnter();
tick(500);
Expand Down
8 changes: 1 addition & 7 deletions src/app/fyle/my-expenses/my-expenses.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ import { AddTxnToReportDialogComponent } from './add-txn-to-report-dialog/add-tx
import { MyExpensesService } from './my-expenses.service';
import { SpenderReportsService } from 'src/app/core/services/platform/v1/spender/reports.service';
import { Report } from 'src/app/core/models/platform/v1/report.model';
import { LaunchDarklyService } from 'src/app/core/services/launch-darkly.service';

@Component({
selector: 'app-my-expenses',
Expand Down Expand Up @@ -193,8 +192,6 @@ export class MyExpensesPage implements OnInit {

restrictPendingTransactionsEnabled = false;

isManualFlagFeatureEnabled$: Observable<{ value: boolean }>;

constructor(
private networkService: NetworkService,
private loaderService: LoaderService,
Expand Down Expand Up @@ -226,8 +223,7 @@ export class MyExpensesPage implements OnInit {
private navController: NavController,
private expenseService: ExpensesService,
private sharedExpenseService: SharedExpenseService,
private spenderReportsService: SpenderReportsService,
private launchDarklyService: LaunchDarklyService
private spenderReportsService: SpenderReportsService
) {}

get HeaderState(): typeof HeaderState {
Expand Down Expand Up @@ -444,8 +440,6 @@ export class MyExpensesPage implements OnInit {
this.backButtonAction
);

this.isManualFlagFeatureEnabled$ = this.launchDarklyService.checkIfManualFlaggingFeatureIsEnabled();

this.tasksService.getExpensesTaskCount().subscribe((expensesTaskCount) => {
this.expensesTaskCount = expensesTaskCount;
});
Expand Down
23 changes: 10 additions & 13 deletions src/app/fyle/my-reports/my-reports.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,16 @@

<ng-container *ngIf="!isLoading; else loading">
<ng-container *ngIf="(simplifyReportsSettings$ | async) as simplifyReportsSettings; else loading">
<ng-container *ngIf="(isManualFlagFeatureEnabled$ | async) as isManualFlagFeatureEnabled; else loading">
<div *ngFor="let report of myReports$ | async as list; let i = index">
<app-reports-card
[report]="report"
[prevDate]="list[i-1]?.created_at"
[simplifyReportsEnabled]="simplifyReportsSettings.enabled"
[isManualFlagFeatureEnabled]="isManualFlagFeatureEnabled.value"
(gotoReport)="onReportClick($event)"
(deleteReport)="onDeleteReportClick($event)"
(viewComments)="onViewCommentsClick()"
></app-reports-card>
</div>
</ng-container>
<div *ngFor="let report of myReports$ | async as list; let i = index">
<app-reports-card
[report]="report"
[prevDate]="list[i-1]?.created_at"
[simplifyReportsEnabled]="simplifyReportsSettings.enabled"
(gotoReport)="onReportClick($event)"
(deleteReport)="onDeleteReportClick($event)"
(viewComments)="onViewCommentsClick()"
></app-reports-card>
</div>
</ng-container>
</ng-container>
<ng-container *ngIf="isConnected$|async">
Expand Down
Loading

0 comments on commit e2759eb

Please sign in to comment.