Browse Source

happiness-manager format subject + clarification

content-update
Clement Denis 3 years ago committed by Clément
parent
commit
890635f3cf
  1. 30
      subjects/happiness-manager/README.md

30
subjects/happiness-manager/README.md

@ -4,11 +4,16 @@
<3 Your pleasure? 💖 That of others Ɛ>
As you're smart, you asked every guest of the party to precise in their answer the kind of drink they would enjoy and the kind of food they would die for.
As you're smart, you asked every guest of the party to precise in their answer
the kind of drink they would enjoy and the kind of food they would die for.
Create a `happiness-manager.mjs` script that sort, in the vips, who wants to drink what and who wants to eat what and integrate that in your barbecue's shopping list!
Create a `happiness-manager.mjs` script that sort, who wants to drink what and
who wants to eat what and integrate that in your barbecue's shopping list!
> note that you must only consider **vips** guests, those that answerd `'yes'`
The script must:
- Take a folder as first argument (the `guest` folder)
- Take a file `.json` as second argument:
- If the file already exists, it will add the informations to it.
@ -16,22 +21,30 @@ The script must:
- Handle case when no one answered yes to the invitation:
- `No one is coming.` has to appear in console.
- No file is updated/created.
- Handle cases when answers contains no "food" information, or no "drink" information
- Handle cases when no one has chosen a cotagory (for example: no one chose to drink softs). This category should not appear in the final list.
- Handle cases when answers contains no "food" information, or no "drink"
information
- Handle cases when no one has chosen a category (for example: no one chose to
drink softs). This category should not appear in the final list.
You have to handle the info like this:
- Drinks:
- Beers: 1 pack / 6 vips (rounded up). Expected key: `6-packs-beers`.
- Water, wine, softs: 1 bottle / 4 vips in each category (rounded up). Expected keys: `wine-bottles`, `water-bottles`, `soft-bottles`.
- Water, wine, softs: 1 bottle / 4 vips in each category (rounded up).
Expected keys: `wine-bottles`, `water-bottles`, `soft-bottles`.
- Food:
- Veggies and vegans: 1 eggplant, 1 courgette, 3 mushrooms and 1 hummus / 3 vips in these categories put together. Expected keys: `eggplants`, `mushrooms`, `hummus`, `courgettes`.
- Veggies and vegans: 1 eggplant, 1 courgette, 3 mushrooms and 1 hummus / 3
vips in these categories put together. Expected keys: `eggplants`,
`mushrooms`, `hummus`, `courgettes`.
- Carnivores: 1 burger per person. Expected key: `burgers`.
- Fish lovers: 1 sardine per person. Expected key: `sardines`.
- Omnivores: 1 chicken+shrimps+pepper kebab / person. Expected key: `kebabs`.
- Bonus: you'll add 1 potatoe per person (all categories put together). Expected key: `potatoes`.
- Bonus: you'll add 1 potatoe per person (all categories put together).
Expected key: `potatoes`.
The infos have to be formated like this in the `.json` file:
```json
```js
{
"key": 1 // according to actual number associated to the elem
}
@ -49,4 +62,3 @@ The infos have to be formated like this in the `.json` file:
- [`JSON.parse()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse)
- [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)
- [Node process: `exit`](https://nodejs.org/api/process.html#process_process_exit_code)

Loading…
Cancel
Save