Closed njyjn closed 3 years ago
state.count.valueChange and state.count.valueChangeAvgPerDay are undefined types. Can't seem to change it into a number for tolocalestring to work. Any suggestions on how to go about doing this?
@Edleyng There is potential for those properties to be undefined as they are optional historical values. Note that in the interface definition the ?
is used to mark it as an optional type https://github.com/njyjn/sg-vaccine-tracker/blob/3e3ff768033726a5b7d31409b9fa843681b2ec57/client/src/types/Count.ts#L13
Therefore, in JS, the property could be either a number
or undefined
. You may want to use the existing formatXXX()
methods which are already implementing the necessary guards
For example, for previous
, if it is applied after the guard if (!previous)
JS knows that previous
can no longer be undefined.
how do I go about testing on my local machine before I want to add and commit it to the branch?
I am working on an easier way to launch everything including the client from a single Docker compose file but that will take a while.
I am also realizing that the manual setup for testing offline requires an AWS account since there is some request signing happening in the background (there are secret tokens hosted on AWS that can be mocked offline but need actual AWS credentials for signing) Hence the impetus for a single Docker compose file that can be shared.
In the meantime unit testing with a mocked DB will probably be the best way forward, but I don't have the bandwidth to look at that yet.
So for now please just commit and I will review on my local machine. Thanks!
Released in #16, great work
The counts on the frontend are not being separated by commas, leading to a hard-to-read experience for users
The starting point is here https://github.com/njyjn/sg-vaccine-tracker/blob/3e3ff768033726a5b7d31409b9fa843681b2ec57/client/src/components/Counts.tsx#L104-L139