Skip to content

Commit 21c48b8

Browse files
committed
neopostmodern#30, neopostmodern#29, neopostmodern#19 filter for sublease, seniors, swap apartments
1 parent d58152d commit 21c48b8

File tree

4 files changed

+135
-2
lines changed

4 files changed

+135
-2
lines changed

app/components/configurationStages/flatDescription.js

+54
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ const flatDescriptionStage: StageDescription = {
3434
mustHaveBalcony,
3535
mustHaveKitchenette,
3636
noKitchenette,
37+
mustBeSwapApartment,
38+
noSwapApartment,
39+
onlyForSeniors,
40+
notSpecificallyForSeniors,
41+
onlySublease,
42+
noSublease,
3743
maximumRent,
3844
minimumArea,
3945
maximumRentPerSquareMeter,
@@ -146,6 +152,54 @@ const flatDescriptionStage: StageDescription = {
146152
/>{' '}
147153
Unbedingt <em>ohne</em> Einbauküche
148154
</div>
155+
<div className={styles.searchParameter}>
156+
<input
157+
type="checkbox"
158+
checked={mustBeSwapApartment}
159+
onChange={() => toggleBoolean('filter.mustBeSwapApartment')}
160+
/>{' '}
161+
Unbedingt <em>eine</em> Tauschwohnung
162+
</div>
163+
<div className={styles.searchParameter}>
164+
<input
165+
type="checkbox"
166+
checked={noSwapApartment}
167+
onChange={() => toggleBoolean('filter.noSwapApartment')}
168+
/>{' '}
169+
Unbedingt <em>keine</em> Tauschwohnung
170+
</div>
171+
<div className={styles.searchParameter}>
172+
<input
173+
type="checkbox"
174+
checked={onlyForSeniors}
175+
onChange={() => toggleBoolean('filter.onlyForSeniors')}
176+
/>{' '}
177+
Nur für Senioren (ab 55 Jahren)
178+
</div>
179+
<div className={styles.searchParameter}>
180+
<input
181+
type="checkbox"
182+
checked={notSpecificallyForSeniors}
183+
onChange={() => toggleBoolean('filter.notSpecificallyForSeniors')}
184+
/>{' '}
185+
Keine Senioren-Wohnungen
186+
</div>
187+
<div className={styles.searchParameter}>
188+
<input
189+
type="checkbox"
190+
checked={onlySublease}
191+
onChange={() => toggleBoolean('filter.onlySublease')}
192+
/>{' '}
193+
Unbedingt Zwischenmiete
194+
</div>
195+
<div className={styles.searchParameter}>
196+
<input
197+
type="checkbox"
198+
checked={noSublease}
199+
onChange={() => toggleBoolean('filter.noSublease')}
200+
/>{' '}
201+
Unbedingt <em>keine</em> Zwischenmiete
202+
</div>
149203
<div className={styles.searchParameter}>
150204
<input
151205
type="checkbox"

app/components/configurationStages/review.js

+18
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,24 @@ const reviewStage: StageDescription = {
127127
<br />
128128
</>
129129
) : null}{' '}
130+
{configuration.filter.mustBeSwapApartment ? (
131+
<>
132+
Tauschwohnung
133+
<br />
134+
</>
135+
) : null}{' '}
136+
{configuration.filter.noSwapApartment? (
137+
<>
138+
keine Tauschwohnung
139+
<br />
140+
</>
141+
) : null}{' '}
142+
{configuration.filter.onlyForSeniors? (
143+
<>
144+
für Senioren
145+
<br />
146+
</>
147+
) : null}{' '}
130148
{configuration.filter.onlyOldBuilding ? (
131149
<>
132150
Altbau

app/flat/assessment.js

+43
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,49 @@ export function assessFlat(
105105
});
106106
}
107107

108+
if (configuration.filter.mustBeSwapApartment) {
109+
reasons.push({
110+
reason: `Tauschwohnung`,
111+
result: overviewDataEntry.title.toLowerCase().includes('tausch') || overviewDataEntry.title.toLowerCase().includes('swap')
112+
});
113+
}
114+
115+
if (configuration.filter.noSwapApartment) {
116+
reasons.push({
117+
reason: `Keine Tauschwohnung`,
118+
result: !(overviewDataEntry.title.toLowerCase().includes('tausch') || overviewDataEntry.title.toLowerCase().includes('swap'))
119+
});
120+
}
121+
122+
if (configuration.filter.onlyForSeniors) {
123+
reasons.push({
124+
reason: `Senioren-Wohnung`,
125+
result: overviewDataEntry.title.toLowerCase().includes('senioren')
126+
});
127+
}
128+
129+
if (configuration.filter.notForSeniors) {
130+
reasons.push({
131+
reason: `Keine Senioren-Wohnung`,
132+
result: !overviewDataEntry.title.toLowerCase().includes('senioren')
133+
});
134+
}
135+
136+
const subleaseCond = overviewDataEntry.title.toLowerCase().includes('zwischenmiete') || overviewDataEntry.title.toLowerCase().includes('befr.') || overviewDataEntry.title.toLowerCase().includes('befristet') || overviewDataEntry.title.toLowerCase().includes(' bis ')
137+
if (configuration.filter.onlySublease) {
138+
reasons.push({
139+
reason: `Zwischenmiete`,
140+
result: subleaseCond
141+
});
142+
}
143+
144+
if (configuration.filter.noSublease) {
145+
reasons.push({
146+
reason: `Keine Zwischenmiete`,
147+
result: !subleaseCond
148+
});
149+
}
150+
108151
if (flatData) {
109152
if (!Number.isNaN(flatData.floor)) {
110153
const normalizedFloor = Math.min(4, flatData.floor);

app/reducers/configuration.js

+20-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ export type configurationBoolean =
3434
| 'mustHaveKitchenette'
3535
| 'noKitchenette'
3636
| 'onlyOldBuilding'
37-
| 'onlyUnfurnished';
37+
| 'onlyUnfurnished'
38+
| 'mustBeSwapApartment'
39+
| 'noSwapApartment'
40+
| 'onlyForSeniors'
41+
| 'notSpecificallyForSeniors'
42+
| 'onlySublease'
43+
| 'noSublease';
3844

3945
export type Filter = {|
4046
postcodes: Array<string>,
@@ -49,6 +55,12 @@ export type Filter = {|
4955
mustHaveBalcony: boolean,
5056
mustHaveKitchenette: boolean,
5157
noKitchenette: boolean,
58+
mustBeSwapApartment: boolean,
59+
noSwapApartment: boolean,
60+
onlyForSeniors: boolean,
61+
notSpecificallyForSeniors: boolean,
62+
onlySublease: boolean,
63+
noSublease: boolean,
5264
floors: Array<number>
5365
|};
5466

@@ -145,7 +157,13 @@ const defaultConfiguration: Configuration = {
145157
hasWBS: false,
146158
mustHaveBalcony: false,
147159
mustHaveKitchenette: false,
148-
noKitchenette: false
160+
noKitchenette: false,
161+
mustBeSwapApartment: false,
162+
noSwapApartment: false,
163+
onlyForSeniors: false,
164+
notSpecificallyForSeniors: false,
165+
onlySublease: false,
166+
noSublease: false
149167
},
150168
applicationText: `${APPLICATION_TEMPLATES.SALUTATION},\n`,
151169
contactData: {

0 commit comments

Comments
 (0)