Skip to content

Commit

Permalink
Merge branch 'release-0.2.21' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
entrotech committed Apr 24, 2021
2 parents 042023c + 737d00a commit 0c33260
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 77 deletions.
8 changes: 4 additions & 4 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tdm-calculator-client",
"version": "0.2.20",
"version": "0.2.21",
"private": true,
"proxy": "http://localhost:5000",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const useStyles = createUseStyles({
calcUnitsCaption: {
flexBasis: "33%",
marginRight: "0.5em",
textAlign: "left",
textAlign: "center",
flexGrow: "0",
flexShrink: "1"
},
Expand Down
12 changes: 11 additions & 1 deletion client/src/components/ProjectWizard/TdmCalculationWizard.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useContext } from "react";
import PropTypes from "prop-types";
import ToastContext from "../../contexts/Toast/ToastContext";
import { withRouter } from "react-router-dom";
import { withRouter, useLocation } from "react-router-dom";
import TermsAndConditionsModal from "../TermsAndConditions/TermsAndConditionsModal";
import CalculationWizardRoutes from "./CalculationWizardRoutes";
import WizardFooter from "./WizardFooter";
Expand Down Expand Up @@ -37,6 +37,16 @@ const TdmCalculationWizard = props => {
const context = useContext(ToastContext);
const page = Number(match.params.page || 1);
const projectId = Number(match.params.projectId);
const { pathname } = useLocation();

/*
When user navigates to a different page in the wizard, scroll to the top.
Issue #802: https://reactrouter.com/web/guides/scroll-restoration
Implemented per: https://reactrouter.com/web/guides/scroll-restoration
*/
useEffect(() => {
window.scrollTo(0, 0);
}, [pathname]);

useEffect(() => {
if (!projectId) {
Expand Down
100 changes: 37 additions & 63 deletions client/src/components/ProjectWizard/WizardPages/ProjectSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,20 @@ import clsx from "clsx";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faClock, faCheckCircle } from "@fortawesome/free-solid-svg-icons";
import Loader from "react-loader";
import { numberWithCommas } from "../helpers";

const useStyles = createUseStyles({
projectSummary: {
display: "flex",
flexDirection: "column",
flex: "1 1 auto",
minWidth: "600px"
},
subtitle: {
marginBottom: 0
flex: "1 1 auto"
},
alignCenter: {
textAlign: "center"
},
grid: {
display: "flex",
flexDirection: "row",
justifyContent: "space-evenly",
marginBottom: "20px"
},
measure: {
height: "132px",
minWidth: "293px",
minWidth: "49%",
display: "flex",
flexDirection: "column",
alignItems: "center",
Expand All @@ -43,45 +34,32 @@ const useStyles = createUseStyles({
marginLeft: "3px"
},
label: {
fontSize: "16px",
fontWeight: 500,
marginTop: "10px",
textTransform: "uppercase"
},
heading: {
marginTop: "1em"
},
rule: {
width: "100%",
display: "flex",
minHeight: "30px"
alignItems: "center",
justifyContent: "space-between",
minHeight: "24px",
margin: "4px auto"
},
ruleName: {
width: "325px",
fontFamily: "Calibri",
fontSize: "16px"
},
wideRule: {
flex: "1 0 75%"
minWidth: "270px"
},
value: {
fontFamily: "Oswald",
fontSize: "18px",
fontWeight: "bold",
textAlign: "right"
},
ruleUnits: {
flex: "0 0 20%",
paddingLeft: "1em"
},
icon: {
flex: "0 0 5%"
},
calcUnits: {
margin: "3px 12px 0 10px"
calcUnitsPts: {
margin: "3px 45px 0 10px"
},
overline: {
borderTop: "2px solid black"
calcUnitsSpcs: {
margin: "3px 38px 0 10px"
},
bold: {
fontFamily: "Calibri Bold"
Expand Down Expand Up @@ -135,15 +113,13 @@ const useStyles = createUseStyles({
marginRight: "17px"
},
projectInfoDetails: {
fontSize: "16px",
fontFamily: "Calibri Bold"
},
categoryContainer: {
marginTop: "40px"
},
categoryHeader: {
fontFamily: "Oswald",
fontSize: "16px",
fontWeight: "bold"
},
resultsContainer: {
Expand All @@ -157,7 +133,6 @@ const useStyles = createUseStyles({
maxWidth: "100%"
},
resultsSuccess: {
fontSize: "16px",
width: "100%",
textAlign: "center",
color: "#748927"
Expand All @@ -167,10 +142,6 @@ const useStyles = createUseStyles({
marginTop: "3px",
paddingTop: "16px"
},
categoryText: {
fontFamily: "Calibri",
fontSize: "16px"
},
measuresContainer: {
borderTop: "1px solid #E7EBF0",
marginTop: "5px",
Expand All @@ -181,38 +152,39 @@ const useStyles = createUseStyles({
fontWeight: "500",
fontSize: "12px",
color: "rgba(15, 41, 64, 0.5)",
paddingTop: "5px"
paddingTop: "5px",
marginRight: "36px"
},
measureDetails: {
fontFamily: "Calibri",
fontSize: "14px",
textAlign: "right",
minWidth: "40px",
marginRight: "10px"
},
measureUnits: {
fontFamily: "Calibri",
fontSize: "14px"
fontSize: "14px",
width: "65px"
},
detailsContainer: {
width: "175px",
display: "flex"
display: "flex",
minWidth: "180px",
maxWidth: "35%"
},
specificationDetailsContainer: {
width: "140px",
display: "flex"
minWidth: "140px",
display: "flex",
justifyContent: "flex-end"
},
pointsContainer: {
width: "100px",
display: "flex",
justifyContent: "flex-end"
},
ruleText: {
fontSize: "14px",
textAlign: "center"
textAlign: "center",
margin: "0 16px"
},
projectDescription: {
fontSize: "16px",
display: "block",
marginTop: "6px"
}
Expand Down Expand Up @@ -439,9 +411,7 @@ const ProjectSummary = props => {

<div className={classes.categoryContainer}>
<span className={classes.categoryHeader}>LAND USES</span>
<div className={classes.landUsesContainer}>
<span className={classes.categoryText}> {`${landUses}`}</span>
</div>
<div className={classes.landUsesContainer}>{landUses}</div>
</div>

<div className={classes.categoryContainer}>
Expand Down Expand Up @@ -482,7 +452,7 @@ const ProjectSummary = props => {
<div className={classes.value}>
{Math.round(rule.calcValue * 100) / 100}
</div>
<div className={classes.calcUnits}>
<div className={classes.calcUnitsPts}>
{rule.calcUnits}
</div>
</div>
Expand Down Expand Up @@ -512,7 +482,7 @@ const ProjectSummary = props => {
<div className={classes.ruleName}>{rule.name}</div>
<div className={classes.specificationDetailsContainer}>
<div className={classes.measureDetails}>
{rule.value}
{numberWithCommas(rule.value)}
</div>
<div className={classes.measureUnits}>
{rule.units}
Expand All @@ -525,28 +495,32 @@ const ProjectSummary = props => {
<div className={classes.measuresContainer}>
{parkingRequired ? (
<div className={classes.rule}>
<div className={clsx(classes.wideRule, classes.bold)}>
<div className={clsx(classes.rule, classes.bold)}>
{parkingRequired.name}
</div>
<div className={clsx(classes.pointsContainer)}>
<div className={clsx(classes.value)}>
{Math.round(parkingRequired.value * 100) / 100}
{numberWithCommas(
Math.round(parkingRequired.value * 100) / 100
)}
</div>
<div className={clsx(classes.calcUnits)}>spcs</div>
<div className={clsx(classes.calcUnitsSpcs)}>spcs</div>
</div>
</div>
) : null}
</div>
{parkingProvided ? (
<div className={classes.rule}>
<div className={clsx(classes.wideRule, classes.bold)}>
<div className={clsx(classes.rule, classes.bold)}>
{parkingProvided.name}
</div>
<div className={classes.pointsContainer}>
<div className={clsx(classes.value)}>
{Math.round(parkingProvided.value * 100) / 100}
{numberWithCommas(
Math.round(parkingProvided.value * 100) / 100
)}
</div>
<div className={clsx(classes.calcUnits)}>spcs</div>
<div className={clsx(classes.calcUnitsSpcs)}>spcs</div>
</div>
</div>
) : null}
Expand Down
3 changes: 3 additions & 0 deletions client/src/components/ProjectWizard/helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const numberWithCommas = x => {
return parseFloat(x).toLocaleString("en");
};
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "root",
"version": "0.2.20",
"version": "0.2.21",
"private": true,
"scripts": {
"release-notes": "gren release --override"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
UPDATE CalculationRule SET units = 'spaces' WHERE calculationId = 1 and units ='spcs';
UPDATE CalculationRule SET units = 'spaces' WHERE calculationId = 1 and units ='spaves';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
UPDATE [dbo].[CalculationRule]
SET name = 'Bike Parking (Required on all new developments)'
WHERE calculationid = 1 AND code ='STRATEGY_BIKE_4';
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
UPDATE [dbo].[CalculationRule]
SET name = 'Car Share Memberships',
dataType = 'choice',
choices = '[{"id": "0", "name":"N/A"},{"id": "1", "name":"Third party operator membership"},{"id": "2", "name":"BlueLA"}]',
description = 'Offer an annual car share membership for at least 50% of residents or employees. Membership to Blue LA Car Share earns an additional point due to the program''s priority on promoting equity in selecting the service area. Consult LADOT in determining if the project location is eligible for Blue LA membership based on the service area.'
WHERE calculationid = 1 AND code ='STRATEGY_CAR_SHARE_3';

UPDATE [dbo].[CalculationRule]
SET functionBody = 'switch(<<STRATEGY_CAR_SHARE_3>>){
case 0: return 0;
case 1: return 3;
case 2: return 4;
}
',
minValue = 3, maxValue = 4
WHERE calculationid = 1 AND code ='PTS_CAR_SHARE_3';

DELETE [dbo].[CalculationRule]
WHERE calculationid = 1 AND code ='STRATEGY_CAR_SHARE_2';

DELETE [dbo].[CalculationRule]
WHERE calculationid = 1 AND code ='PTS_CAR_SHARE_2';

UPDATE [dbo].[CalculationRule]
SET functionBody = 'return <<PTS_CAR_SHARE_1>> +
<<PTS_CAR_SHARE_3>> +
<<PTS_CAR_SHARE_4>> +
<<PTS_CAR_SHARE_BONUS>> +
<<PTS_CAR_SHARE_ELECTRIC>> ;
'
WHERE calculationid = 1 AND code ='PTS_CAR_SHARE';

UPDATE [dbo].[CalculationRule]
SET functionBody = '
// <<STRATEGY_CAR_SHARE_BONUS>>
return (Math.sign(<<PTS_CAR_SHARE_1>>)
+ Math.sign(<<PTS_CAR_SHARE_3>>)
+ Math.sign(<<PTS_CAR_SHARE_4>>) > 1) ? 2 : 0;
'
WHERE calculationid = 1 AND code ='PTS_CAR_SHARE_BONUS';
2 changes: 1 addition & 1 deletion server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0c33260

Please sign in to comment.