Skip to content

Commit 8a135c2

Browse files
committed
fix(program): fix default value for additional required checkbox variant
1 parent 7b96aea commit 8a135c2

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

projects/social_platform/src/app/domain/program/partner-program-fields.model.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,14 @@ export class PartnerProgramFieldsValues {
2222

2323
export class ProjectNewAdditionalProgramFields {
2424
fieldId!: number;
25-
valueText!: string | boolean;
25+
valueText!: string;
2626

2727
/**
2828
* Единая точка сборки DTO из доменного поля.
2929
* Резолв значения (форма / опции по умолчанию) остаётся за вызывающим —
3030
* это единственное, что реально отличается между флоу.
3131
*/
32-
static fromField(
33-
field: PartnerProgramFields,
34-
value: string | boolean,
35-
): ProjectNewAdditionalProgramFields {
32+
static fromField(field: PartnerProgramFields, value: string): ProjectNewAdditionalProgramFields {
3633
return { fieldId: field.id, valueText: value };
3734
}
3835
}

projects/social_platform/src/app/ui/widgets/detail/services/program/detail-program-info.service.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ export class DetailProgramInfoService {
4949
.pipe(
5050
switchMap(filtersResult => {
5151
const fields = filtersResult.ok ? filtersResult.value.programFields : [];
52-
const newFieldsFormValues = fields.map(field =>
53-
ProjectNewAdditionalProgramFields.fromField(field, this.placeholderFor(field)),
54-
);
52+
const newFieldsFormValues = fields
53+
.filter(field => field.fieldType !== "file")
54+
.map(field =>
55+
ProjectNewAdditionalProgramFields.fromField(field, this.placeholderFor(field)),
56+
);
5557
const body = { project: this.projectForm.value, programFieldValues: newFieldsFormValues };
5658
return this.applyProjectToProgramUseCase.execute(programId, body);
5759
}),
@@ -81,8 +83,8 @@ export class DetailProgramInfoService {
8183
});
8284
}
8385

84-
private placeholderFor(field: PartnerProgramFields): string | boolean {
85-
if (field.fieldType === "checkbox") return false;
86+
private placeholderFor(field: PartnerProgramFields): string {
87+
if (field.fieldType === "checkbox") return "false";
8688
if (field.options.length > 0) return field.options[0];
8789
return "-";
8890
}

0 commit comments

Comments
 (0)