Skip to content

Commit

Permalink
lint change
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammed farhan K authored and Mohammed farhan K committed Nov 4, 2024
1 parent f311576 commit df336e2
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/app/core/services/custom-inputs.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export class CustomInputsService {

fillCustomProperties(orgCategoryId: number, customProperties: Partial<CustomInput>[]): Observable<CustomField[]> {
return this.getAllinView().pipe(
// Filter out dependent selects
map((allCustomInputs) => allCustomInputs.filter((customInput) => customInput.type !== 'DEPENDENT_SELECT')),
map((allCustomInputs) => {
const customInputs = this.filterByCategory(allCustomInputs, orgCategoryId);
Expand Down Expand Up @@ -124,15 +123,7 @@ export class CustomInputsService {
}

// Add the property to `filledCustomProperties` based on new logic
// Include active fields
// Include Disabled fields which has Historical values
if (
customInput.is_enabled ||
(!customInput.is_enabled &&
property.value !== null &&
property.value !== undefined &&
this.getCustomPropertyDisplayValue(property) !== '-')
) {
if (this.shouldIncludeProperty(customInput as unknown as CustomInput, property)) {
filledCustomProperties.push({
...property,
displayValue: this.getCustomPropertyDisplayValue(property),
Expand All @@ -144,6 +135,16 @@ export class CustomInputsService {
);
}

private shouldIncludeProperty(customInput: CustomInput, property: CustomField): boolean {
return (
customInput.is_enabled ||
(!customInput.is_enabled &&
property.value !== null &&
property.value !== undefined &&
this.getCustomPropertyDisplayValue(property) !== '-')
);
}

setCustomPropertyValue(property: CustomField, customProperties: Partial<CustomInput>[], index: number): void {

Check failure on line 148 in src/app/core/services/custom-inputs.service.ts

View workflow job for this annotation

GitHub Actions / Run linters

Member setCustomPropertyValue should be declared before all private instance method definitions
if (property.type === 'DATE' && customProperties[index].value) {
property.value = new Date(<string>customProperties[index].value);
Expand Down

0 comments on commit df336e2

Please sign in to comment.