Skip to content

Commit 3ecaee7

Browse files
committed
feat: add carpool on van
1 parent 319663f commit 3ecaee7

22 files changed

Lines changed: 487 additions & 56 deletions

File tree

app/api/v1/transport/route.ts

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,19 @@ export const computeTransportEmission = (
3838
carpool: index + 1,
3939
slug: `${transportation.slug}+${index + 1}`,
4040
id:
41+
// voiture thermique
4142
transportation.id === 4
4243
? 22 + index
43-
: transportation.id === 5
44+
: // voiture électrique
45+
transportation.id === 5
4446
? 26 + index
45-
: (transportation.id || 0) + index + 1,
47+
: // camping car
48+
transportation.id === 31
49+
? 205 + index
50+
: // van
51+
transportation.id === 35
52+
? 209 + index
53+
: (transportation.id || 0) + index + 1,
4654
})),
4755
transportation,
4856
] as Equivalent[])
@@ -182,11 +190,11 @@ export const computeTransportEmission = (
182190
* - 28 : Covoiturage électrique (4 personnes)
183191
* - 29 : Covoiturage électrique (5 personnes)
184192
* - 30 : Marche
185-
* - 31 : Camping-car
193+
* - 31 : Camping-car (1 personne)
186194
* - 32 : Moto thermique (<= 250 cm³)
187195
* - 33 : Scooter électrique
188196
* - 34 : Vélo cargo triporteur
189-
* - 35 : Van
197+
* - 35 : Van (1 personne)
190198
* - 100 : Voiture - Petite - Essence
191199
* - 101 : Voiture - Petite - Essence (2 personnes)
192200
* - 102 : Voiture - Petite - Essence (3 personnes)
@@ -292,6 +300,14 @@ export const computeTransportEmission = (
292300
* - 202 : Voiture hybride (3 personnes)
293301
* - 203 : Voiture hybride (4 personnes)
294302
* - 204 : Voiture hybride (5 personnes)
303+
* - 205 : Camping-car (2 personnes)
304+
* - 206 : Camping-car (3 personnes)
305+
* - 207 : Camping-car (4 personnes)
306+
* - 208 : Camping-car (5 personnes)
307+
* - 209 : Van (2 personnes)
308+
* - 210 : Van (3 personnes)
309+
* - 211 : Van (4 personnes)
310+
* - 212 : Van (5 personnes)
295311
* - in: query
296312
* name: ignoreRadiativeForcing
297313
* default: 0
@@ -377,7 +393,9 @@ export async function GET(req: NextRequest) {
377393
.filter((emission) => !numberOfPassenger || !emission.carpool)
378394
.map((emission) => ({
379395
id: emission.id,
380-
name: emission.name,
396+
name: numberOfPassenger
397+
? emission.name.replace(' (1 personne)', '').replace(' (1 people)', '').replace(' (1 persona)', '')
398+
: emission.name,
381399
value: emission.emissions.kgco2e / (((emission.withCarpool && numberOfPassenger) || 0) + 1),
382400
})),
383401
warning: hasAPIKey

public/equivalents.csv

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,11 @@ Avion trajet moyen,0.184661,Transport,avion-moyencourrier,https://impactco2.fr/o
284284
Avion trajet moyen à long,0.166794,Transport,avion-moyenlongcourrier,https://impactco2.fr/outils/transport/avion-moyenlongcourrier
285285
Bus électrique,0.0217,Transport,buselectrique,https://impactco2.fr/outils/transport/buselectrique
286286
Bus thermique,0.12242,Transport,busthermique,https://impactco2.fr/outils/transport/busthermique
287-
Camping-car,0.49383327166930846,Transport,campingcar,https://impactco2.fr/outils/transport/campingcar
287+
Camping-car thermique (1 personne),0.49383327166930846,Transport,campingcar,https://impactco2.fr/outils/transport/campingcar
288+
Camping-car thermique (2 personnes),0.24691663583465423,Transport,campingcar+1,https://impactco2.fr/outils/transport/campingcar+1
289+
Camping-car thermique (3 personnes),0.16461109055643616,Transport,campingcar+2,https://impactco2.fr/outils/transport/campingcar+2
290+
Camping-car thermique (4 personnes),0.12345831791732712,Transport,campingcar+3,https://impactco2.fr/outils/transport/campingcar+3
291+
Camping-car thermique (5 personnes),0.0987666543338617,Transport,campingcar+4,https://impactco2.fr/outils/transport/campingcar+4
288292
Covoiturage électrique (2 personnes),0.03368263111477168,Transport,voitureelectrique+1,https://impactco2.fr/outils/transport/voitureelectrique+1
289293
Covoiturage électrique (3 personnes),0.02245508740984779,Transport,voitureelectrique+2,https://impactco2.fr/outils/transport/voitureelectrique+2
290294
Covoiturage électrique (4 personnes),0.01684131555738584,Transport,voitureelectrique+3,https://impactco2.fr/outils/transport/voitureelectrique+3
@@ -389,7 +393,11 @@ TER,0.02769,Transport,ter,https://impactco2.fr/outils/transport/ter
389393
TGV,0.00293,Transport,tgv,https://impactco2.fr/outils/transport/tgv
390394
Tramway,0.00428,Transport,tramway,https://impactco2.fr/outils/transport/tramway
391395
Trottinette à assistance électrique,0.0249,Transport,trottinette,https://impactco2.fr/outils/transport/trottinette
392-
Van,0.3246260116693085,Transport,van,https://impactco2.fr/outils/transport/van
396+
Van thermique (1 personne),0.3246260116693085,Transport,van,https://impactco2.fr/outils/transport/van
397+
Van thermique (2 personnes),0.16231300583465424,Transport,van+1,https://impactco2.fr/outils/transport/van+1
398+
Van thermique (3 personnes),0.10820867055643617,Transport,van+2,https://impactco2.fr/outils/transport/van+2
399+
Van thermique (4 personnes),0.08115650291732712,Transport,van+3,https://impactco2.fr/outils/transport/van+3
400+
Van thermique (5 personnes),0.0649252023338617,Transport,van+4,https://impactco2.fr/outils/transport/van+4
393401
Vélo à assistance électrique,0.010950000000000001,Transport,veloelectrique,https://impactco2.fr/outils/transport/veloelectrique
394402
Vélo cargo triporteur,0.014827,Transport,triporteurelectrique,https://impactco2.fr/outils/transport/triporteurelectrique
395403
Vélo mécanique,0.00017,Transport,velo,https://impactco2.fr/outils/transport/velo
Lines changed: 112 additions & 0 deletions
Loading

public/icons/covoituragevan.svg

Lines changed: 75 additions & 0 deletions
Loading

src/components/comparateur/overscreens/equivalentCategories.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,12 @@ export const subCategories = {
156156
'voiture-grandeberline-hybriderechargeable+4',
157157
],
158158
},
159+
van: {
160+
van: ['van', 'van+1', 'van+2', 'van+3', 'van+4'],
161+
},
162+
campingcar: {
163+
campingcar: ['campingcar', 'campingcar+1', 'campingcar+2', 'campingcar+3', 'campingcar+4'],
164+
},
159165
magasin: {
160166
foot: ['magasindouce', 'magasindouce2kg', 'magasindouce15kg', 'magasindouce30kg'],
161167
car: ['magasin', 'magasin2kg', 'magasin15kg', 'magasin30kg'],

src/components/outils/CategorySimulator.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,11 @@ const CategorySimulator = ({
215215
{legends && <p className='ico2-hidden'>{barExplanation}</p>}
216216
</div>
217217
</Link>
218-
{(equivalent.slug.startsWith('voiture') || equivalent.slug.startsWith('moto')) && type && (
219-
<Carpool carpoolValue={equivalent.carpool} type={type} equivalent={equivalent} />
220-
)}
218+
{(equivalent.slug.startsWith('voiture') ||
219+
equivalent.slug.startsWith('moto') ||
220+
equivalent.slug.startsWith('van') ||
221+
equivalent.slug.startsWith('campingcar')) &&
222+
type && <Carpool carpoolValue={equivalent.carpool} type={type} equivalent={equivalent} />}
221223
{!!equivalent.livraison && <LivraisonType equivalent={equivalent} />}
222224
</li>
223225
)

src/components/outils/equivalents/simulators/EquivalentHeader.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const EquivalentHeader = ({ category, equivalent }: { category: Category; equiva
2525

2626
const hasPre = pre !== `equivalent.hypothesis.pre.${equivalent.slug}`
2727
const hasPost = post !== `equivalent.hypothesis.post.${equivalent.slug}`
28+
2829
return (
2930
<>
3031
<EquivalentCardContent equivalent={equivalent} category={category} />
@@ -33,7 +34,12 @@ const EquivalentHeader = ({ category, equivalent }: { category: Category; equiva
3334
<span className={styles.hypothesisTitle}>{t('hypotheses')}</span>
3435
{'months' in equivalent && <span>{getMonthsLabel(equivalent.months, language)} </span>}
3536
{hasPre && <span>{pre}</span>}
36-
{equivalent.carpool && <span> - {getCarpool(language, equivalent.carpool)}</span>}
37+
{equivalent.carpool && (
38+
<span>
39+
{hasPre ? ' - ' : ''}
40+
{getCarpool(language, equivalent.carpool)}
41+
</span>
42+
)}
3743
{hasPost && (
3844
<span>
3945
{hasPre ? ' ' : ''}

0 commit comments

Comments
 (0)