Skip to content

Commit c719972

Browse files
committed
docs: appliance calculator docs
1 parent 402693c commit c719972

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# The Appliance Calculator
2+
3+
## Overview
4+
5+
The Appliance Calculator allows users to enter the appliances wish to compare, how long they use them for and how much they pay for
6+
their electricity. It then provides a table ordered from most to least expensive.
7+
8+
Controllers, views and components have been scoped to the `ApplianceCalculator` namespace.
9+
10+
## Form
11+
12+
The app uses the `wizard_steps` gem to provide the multi-step form functionality to create a `DailyUsage` object. These are stored in the
13+
session (up to a maximum of 10) and rendered into the `UsagesTableComponent`.
14+
15+
## Interactive Tool Iframe
16+
17+
The app is iframed into an advice page using the `InteractiveToolRenderer` in the public-website repo. A content type exists in Contentful that represents a tool and allows it to be embedded into an advice collection. The renderer in public website then creates and renders an `InteractiveToolComponent`, which is essentially an `iframe` with a `src` that points to this application.
18+
19+
The iframe is resized as instructed by the `postMessage` sent to the `parent` window via the js in the `app/javascript/modules/resize-iframe.js` module.
20+
21+
There are some more notes [interactive tool docs](https://github.com/citizensadvice/public-website/blob/f019add8aac688659f61548afcff727811d281d4/docs/advice/interactive-tools.md?plain=1#L1).
22+
23+
## Contentful Entries
24+
25+
### Appliances
26+
27+
Appliances in the app are represented by the `Appliance` content type. Like intranet content, test and production data are both stored in the `master` Contentful environment. The `test` tag in Contentful is used to distinguish between the two.
28+
29+
Details of the model fields and their meanings can be found in the energy team's Google Drive: https://docs.google.com/document/d/1WhrKpLv7HiOKMuSQ_APuD38Pi6w3ouiY7AvZsjTMQQs/edit?usp=sharing
30+
31+
#### Cyclical & Time Based Appliances
32+
33+
There are two types of appliance: cyclical and time based. Cyclical appliances have fixed consumptions each time they are used, like a washing machine. Time based usages have variable consumptions that depend on how long they are used for, like a TV. The `CyclicalDailyUsage` and `TimeBasedDailyUsage` objects contain the logic for working out `kWh` consumption based on the data entered by the user.

0 commit comments

Comments
 (0)