Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for secondary construction materials #790

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

matkoniecz
Copy link
Contributor

part of #727

@matkoniecz
Copy link
Contributor Author

Note that primary materials are not appearing to be validated and just rely on https://github.com/colouring-cities/colouring-london/blob/master/app/src/frontend/building/data-containers/construction.tsx#L10 being in synch with database (I think?).

See also https://github.com/colouring-cities/colouring-london/blob/master/app/src/frontend/building/data-containers/community.tsx#L127 repeating public_ownership_type enum.

I am not entirely sure is this database-based verification is needed. Maybe it should be limited to dropdown selection and block freeform entries? Maybe it is superior to relying on this manually maintained copy of valid value list?

@edwardchalstrey1
Copy link
Contributor

edwardchalstrey1 commented Mar 3, 2022

I have tried to take a look at this but it creates an error in the app for me. I did the following:

  1. Check out this branch
  2. Run psql -f migrations/027.secondary_materials.up.sql (I have the db env var set to "colouringlondondb") - this ran fine
  3. npm start:
ed@ed-VirtualBox:~/colouring-london/app$ npm start

> [email protected] start
> razzle start

 WAIT  Compiling...


✔ Client


✔ Server
  Compiled successfully in 13.91s

Issues checking in progress...
ERROR in src/frontend/route.tsx:36:25
TS2339: Property 'from' does not exist on type '{}'.
    34 |         render={props => {
    35 |             if(isAuthenticated) {
  > 36 |                 const { from } = props.location.state ?? { from: '/my-account.html'};
       |                         ^^^^
    37 |                 return <Redirect to={{pathname: from }} />;
    38 |             } else {
    39 |                 if(Component) {

sswp> Handling Hot Module Reloading
✅  Server-side HMR Enabled!
🚀  started

And the result at http://localhost:8080/ is that the homepage is viewable but unresponsive (I can't click anything)

@edwardchalstrey1
Copy link
Contributor

@matkoniecz I realise that the error I posted above might be some basic typescript error that I don't understand without looking into it more Property 'from' does not exist on type '{}', I get the same error on #785 & #791 so perhaps is there some easy step I can take here? I will look into it further if it's not immediately obvious to you 😄

@tomalrussell
Copy link
Contributor

@matkoniecz I realise that the error I posted above might be some basic typescript error that I don't understand without looking into it more Property 'from' does not exist on type '{}', I get the same error on #785 & #791 so perhaps is there some easy step I can take here? I will look into it further if it's not immediately obvious to you smile

colouring-cities@4e40b31 should do it

}

if(hasDuplicates(groupMaterials)) {
throw new ArgumentError('Cannot supply duplicate materials', 'secondaryMaterialsUpdate');
Copy link
Contributor

@edwardchalstrey1 edwardchalstrey1 Mar 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, I have just one comment - perhaps similar to this error thrown here, can there be one for when the Main Secondary Construction Material/s selected is the same as the Core Material (presumably we don't want that)

Copy link
Contributor

@tomalrussell tomalrussell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just suggested a fix for typo which crept in, otherwise good to go.

I'd be open to a separate discussion of data typing and storage. I think this approach works okay, but we are incrementally adding complex data types to our one big table. Could consider moving towards more normalised tables, (or another direction, e.g. towards JSON blobs) - but would suggest doing that with a look across the data model as a whole.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants