Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions src/app/ideation/components/add-idea/add-idea.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,30 +423,33 @@ export class AddIdeaComponent {

return Object.keys(this.ideation.demographicsConfig).reduce(
(acc: Idea['demographics'], curr: string) => {
if (curr === 'residence') {
const prefix = this.translate.instant(
'COMPONENTS.ADD_IDEA.RESIDENCE_VALUE_PREFIX'
);
/**
* Prefix used to define open field value in the database
* for easier filtering.
* @see https://github.com/citizenos/citizenos-fe/issues/2081
*/
const prefix = "other: ";

if (curr === 'residence') {
return {
...acc,
residence: this.isCountryEstonia
? this.filtersData.residence.selectedValue
: prefix + this.ideation.demographicsConfig?.[curr].value,
residence:
this.ideation.demographicsConfig?.[curr].value ?
prefix + this.ideation.demographicsConfig?.[curr].value :
this.filtersData.residence.selectedValue,
};
}
if (curr === 'gender') {
const prefix = this.translate.instant(
'COMPONENTS.ADD_IDEA.GENDER_VALUE_PREFIX'
);

if (curr === 'gender') {
return {
...acc,
gender:
prefix + this.ideation.demographicsConfig?.[curr].value ||
this.filtersData.gender.selectedValue,
this.ideation.demographicsConfig?.[curr].value ?
prefix + this.ideation.demographicsConfig?.[curr].value :
this.filtersData.gender.selectedValue,
};
}

return {
...acc,
[curr]: this.ideation.demographicsConfig?.[curr].value || '',
Expand Down