replaced uses of getGrainUnit to the users grainUnit function to pull form logged in users settings rather than local storage
This commit is contained in:
parent
dc54f99abd
commit
cabc0146ed
22 changed files with 146 additions and 250 deletions
|
|
@ -17,7 +17,7 @@ import moment from "moment";
|
|||
import { pond } from "protobuf-ts/pond";
|
||||
import { useGlobalState } from "providers";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { celsiusToFahrenheit, getGrainUnit, or } from "utils";
|
||||
import { celsiusToFahrenheit, or } from "utils";
|
||||
//import { useHistory } from "react-router";
|
||||
//import BinModeDot from "./BinModeDot";
|
||||
import BinSVGV2 from "./BinSVGV2";
|
||||
|
|
@ -444,16 +444,16 @@ export default function BinCard(props: Props) {
|
|||
);
|
||||
}
|
||||
|
||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1) {
|
||||
if (user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1) {
|
||||
return (
|
||||
bin.grainInventory().toLocaleString() +
|
||||
bin.grainInventory(user).toLocaleString() +
|
||||
" mT " +
|
||||
bin.fillPercent() +
|
||||
"%"
|
||||
);
|
||||
} else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1) {
|
||||
} else if (user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1) {
|
||||
return (
|
||||
bin.grainInventory().toLocaleString() +
|
||||
bin.grainInventory(user).toLocaleString() +
|
||||
" t " +
|
||||
bin.fillPercent() +
|
||||
"%"
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ import { pond } from "protobuf-ts/pond";
|
|||
import { useBinAPI, useBinYardAPI, useGlobalState, useLibraCartProxyAPI } from "providers";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
// import { useHistory } from "react-router";
|
||||
import { or, getGrainUnit } from "utils";
|
||||
import { or } from "utils";
|
||||
import { makeStyles } from "@mui/styles";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import BinSelector from "./BinSelector";
|
||||
|
|
@ -240,16 +240,16 @@ export default function BinSettings(props: Props) {
|
|||
initForm.inventory.bushelsPerTonne = grain.bushelsPerTonne;
|
||||
}
|
||||
|
||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||
if(user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||
setBushelConversion(initForm.inventory.bushelsPerTonne)
|
||||
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||
}else if (user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||
setBushelConversion(initForm.inventory.bushelsPerTonne * 0.907)
|
||||
}
|
||||
if (initForm.inventory.customGrain){
|
||||
setCustomGrain(initForm.inventory.customGrain)
|
||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||
if(user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||
setBushelConversion(initForm.inventory.customGrain.bushelsPerTonne)
|
||||
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||
}else if (user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||
setBushelConversion(initForm.inventory.customGrain.bushelsPerTonne * 0.907)
|
||||
}
|
||||
}
|
||||
|
|
@ -304,15 +304,15 @@ export default function BinSettings(props: Props) {
|
|||
: initForm.inventory?.grainBushels ?? 0;
|
||||
let weight = ""
|
||||
if(initForm.inventory){
|
||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||
if(user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||
weight = (gb/initForm.inventory.bushelsPerTonne).toFixed(2)
|
||||
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||
}else if (user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||
weight = (gb/(initForm.inventory.bushelsPerTonne * 0.907)).toFixed(2)
|
||||
}
|
||||
if(initForm.inventory.customGrain){
|
||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||
if(user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||
weight = (gb/initForm.inventory.customGrain.bushelsPerTonne).toFixed(2)
|
||||
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||
}else if (user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||
weight = (gb/(initForm.inventory.customGrain.bushelsPerTonne * 0.907)).toFixed(2)
|
||||
}
|
||||
}
|
||||
|
|
@ -804,7 +804,7 @@ export default function BinSettings(props: Props) {
|
|||
const binQuantity = formExtension.grainBushels;
|
||||
|
||||
//as long as the storage type is not fertilizer it is some sort of grain, whether it is supported or custom is not important in this instance so we do not need to check for unknown
|
||||
if(storageType !== pond.BinStorage.BIN_STORAGE_FERTILIZER && ((getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE || getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON) && bushelConversion !== 0 && grainWeight !== "")){
|
||||
if(storageType !== pond.BinStorage.BIN_STORAGE_FERTILIZER && ((user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE || user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TON) && bushelConversion !== 0 && grainWeight !== "")){
|
||||
return (
|
||||
<TextField
|
||||
label="Amount"
|
||||
|
|
@ -830,7 +830,7 @@ export default function BinSettings(props: Props) {
|
|||
variant="outlined"
|
||||
disabled={!canEdit}
|
||||
InputProps={{
|
||||
endAdornment: <InputAdornment position="end">{getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE ? "mT" : "t"}</InputAdornment>
|
||||
endAdornment: <InputAdornment position="end">{user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE ? "mT" : "t"}</InputAdornment>
|
||||
}}
|
||||
className={classes.bottomSpacing}
|
||||
/>
|
||||
|
|
@ -1179,9 +1179,9 @@ export default function BinSettings(props: Props) {
|
|||
setCustomGrain(newGrainSettings)
|
||||
let conversion = 0
|
||||
|
||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||
if(user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||
conversion = newGrainSettings.bushelsPerTonne
|
||||
}else if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||
}else if(user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||
conversion = newGrainSettings.bushelsPerTonne * 0.907
|
||||
}
|
||||
updateForm(
|
||||
|
|
@ -1218,9 +1218,9 @@ export default function BinSettings(props: Props) {
|
|||
})
|
||||
);
|
||||
let conversion = 0
|
||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||
if(user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||
conversion = GrainDescriber(newGrainType).bushelsPerTonne
|
||||
}else if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||
}else if(user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||
conversion = GrainDescriber(newGrainType).bushelsPerTon
|
||||
}
|
||||
setBushelConversion(conversion)
|
||||
|
|
|
|||
|
|
@ -10,11 +10,10 @@ import { Transaction } from "models/Transaction";
|
|||
import moment from "moment";
|
||||
import ObjectDescriber from "objects/ObjectDescriber";
|
||||
import { pond } from "protobuf-ts/pond";
|
||||
import { useBinAPI, useContractAPI, useFieldAPI, useGrainBagAPI, useSnackbar, useTransactionAPI } from "providers";
|
||||
import { useBinAPI, useContractAPI, useFieldAPI, useGlobalState, useGrainBagAPI, useSnackbar, useTransactionAPI } from "providers";
|
||||
import React from "react";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import TransactionDataDisplay from "transactions/transactionDataDisplay";
|
||||
import { getGrainUnit } from "utils";
|
||||
|
||||
interface Props {
|
||||
bin: Bin
|
||||
|
|
@ -26,6 +25,7 @@ export default function BinTransactions(props: Props){
|
|||
const { bin, permissions, refresh } = props
|
||||
const [state, setState] = useState<pond.TransactionState>(pond.TransactionState.TRANSACTION_STATE_APPROVAL_REQUIRED)
|
||||
const transactionAPI = useTransactionAPI()
|
||||
const [{user}] = useGlobalState()
|
||||
const binAPI = useBinAPI()
|
||||
const grainBagAPI = useGrainBagAPI()
|
||||
const fieldAPI = useFieldAPI()
|
||||
|
|
@ -103,7 +103,7 @@ export default function BinTransactions(props: Props){
|
|||
const loadContracts = useCallback(()=>{
|
||||
contractAPI.listContracts(0,0, "asc", "name").then(resp => {
|
||||
setContractOptions(resp.data.contracts.map(c => {
|
||||
let contract = Contract.create(c)
|
||||
let contract = Contract.create(c, user)
|
||||
return {label: contract.name(), value: contract.key(), group: contract.grainName()}
|
||||
}))
|
||||
})
|
||||
|
|
@ -198,11 +198,11 @@ export default function BinTransactions(props: Props){
|
|||
|
||||
const grainQuantityDisplay = (bushels: number) => {
|
||||
const grainTransaction = selectedTransaction?.transaction.transaction?.grainTransaction ?? pond.GrainTransaction.create()
|
||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && grainTransaction.bushelsPerTonne > 1){
|
||||
if(user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && grainTransaction.bushelsPerTonne > 1){
|
||||
let tonneWeight = bushels / grainTransaction.bushelsPerTonne
|
||||
return tonneWeight + " mT"
|
||||
}
|
||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && grainTransaction.bushelsPerTonne > 1){
|
||||
if(user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && grainTransaction.bushelsPerTonne > 1){
|
||||
let tonneWeight = bushels / (grainTransaction.bushelsPerTonne * 0.907)
|
||||
return tonneWeight + " t"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import { FullScreen, useFullScreenHandle } from "react-full-screen";
|
|||
import moment, { Moment } from "moment";
|
||||
import ResponsiveDialog from "common/ResponsiveDialog";
|
||||
import { getThemeType } from "theme";
|
||||
import { getGrainUnit, or } from "utils";
|
||||
import { or } from "utils";
|
||||
import { useBinAPI } from "providers/pond/binAPI";
|
||||
import BindaptIcon from "products/Bindapt/BindaptIcon";
|
||||
import {
|
||||
|
|
@ -498,9 +498,9 @@ export default function BinVisualizer(props: Props) {
|
|||
if (bin.storage() === pond.BinStorage.BIN_STORAGE_FERTILIZER) {
|
||||
return Math.round(val * 35.239 * 100) / 100;
|
||||
} else {
|
||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1) {
|
||||
if (user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1) {
|
||||
return Math.round((val / bin.bushelsPerTonne()) * 100) / 100;
|
||||
} else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1) {
|
||||
} else if (user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1) {
|
||||
return Math.round((val / (bin.bushelsPerTonne()*0.907)) * 100) / 100;
|
||||
}
|
||||
}
|
||||
|
|
@ -516,9 +516,9 @@ export default function BinVisualizer(props: Props) {
|
|||
if (bin.storage() === pond.BinStorage.BIN_STORAGE_FERTILIZER) {
|
||||
return " / " + capacity.toLocaleString() + " L";
|
||||
}
|
||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1) {
|
||||
if (user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1) {
|
||||
return "mT (" + bin.fillPercent() + "%)";
|
||||
} else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1) {
|
||||
} else if (user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1) {
|
||||
return "t (" + bin.fillPercent() + "%)";
|
||||
} else {
|
||||
return " / " + capacity.toLocaleString() + " bu";
|
||||
|
|
@ -1328,14 +1328,14 @@ export default function BinVisualizer(props: Props) {
|
|||
}
|
||||
}
|
||||
|
||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1) {
|
||||
if (user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1) {
|
||||
diffDisplay = diffDisplay / bin.bushelsPerTonne();
|
||||
if (pendingDisplay) {
|
||||
pendingDisplay = pendingDisplay / bin.bushelsPerTonne();
|
||||
}
|
||||
}
|
||||
|
||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1) {
|
||||
if (user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1) {
|
||||
diffDisplay = diffDisplay / (bin.bushelsPerTonne()*0.907);
|
||||
if (pendingDisplay) {
|
||||
pendingDisplay = pendingDisplay / (bin.bushelsPerTonne()*0.907);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import { Bin } from "models";
|
|||
import { pond } from "protobuf-ts/pond";
|
||||
import { useBinAPI, useGlobalState } from "providers";
|
||||
import React, { useEffect, useState, useCallback, SetStateAction } from "react";
|
||||
import { getGrainUnit, stringToMaterialColour } from "utils";
|
||||
import { stringToMaterialColour } from "utils";
|
||||
//import BinsFansStatusTable from "./BinFansStatusTable";
|
||||
import BinsList from "./BinsList";
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ export default function BinyardDisplay(props: Props) {
|
|||
const isMobile = useMobile();
|
||||
const [carouselIndex, setCarouselIndex] = useState(0);
|
||||
const [binMenuAnchorEl, setBinMenuAnchorEl] = useState<Element | null>(null);
|
||||
const [{ as }] = useGlobalState();
|
||||
const [{ as, user }] = useGlobalState();
|
||||
const maxBins = 40;
|
||||
const [binsLoading, setBinsLoading] = useState(false);
|
||||
const [expandTotal, setExpandTotal] = useState(false);
|
||||
|
|
@ -658,7 +658,7 @@ export default function BinyardDisplay(props: Props) {
|
|||
return " bu";
|
||||
}
|
||||
|
||||
switch (getGrainUnit()) {
|
||||
switch (user.grainUnit()) {
|
||||
case pond.GrainUnit.GRAIN_UNIT_TONNE:
|
||||
return " mT";
|
||||
case pond.GrainUnit.GRAIN_UNIT_TON:
|
||||
|
|
@ -671,9 +671,9 @@ export default function BinyardDisplay(props: Props) {
|
|||
const customQuantityDisplay = (customInventory: pond.CustomInventory, bushels: number) => {
|
||||
let amount = bushels
|
||||
if(customInventory.bushelsPerTonne > 1){
|
||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||
if(user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||
amount = bushels/customInventory.bushelsPerTonne
|
||||
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||
}else if (user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||
amount = bushels/(customInventory.bushelsPerTonne*0.907)
|
||||
}
|
||||
}
|
||||
|
|
@ -683,9 +683,9 @@ export default function BinyardDisplay(props: Props) {
|
|||
const supportedGrainDisplay = (grain: pond.Grain, bushels: number) => {
|
||||
const describer = GrainDescriber(grain)
|
||||
let amount = bushels
|
||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||
if(user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||
amount = bushels/describer.bushelsPerTonne
|
||||
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||
}else if (user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||
amount = bushels/describer.bushelsPerTon
|
||||
}
|
||||
return Math.round(amount*100)/100
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import { pond } from "protobuf-ts/pond";
|
|||
import { useBinAPI, useGlobalState } from "providers";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { Legend } from "recharts";
|
||||
import { getGrainUnit } from "utils";
|
||||
import BinLevelAreaGraph from "./BinLevelAreaGraph";
|
||||
|
||||
interface Props {
|
||||
|
|
@ -32,7 +31,7 @@ interface InventoryAt {
|
|||
export default function BinLevelOverTime(props: Props) {
|
||||
const { bin, fertilizerBin, colour, startDate, endDate, customHeight } = props;
|
||||
const binAPI = useBinAPI();
|
||||
const [{as}] = useGlobalState();
|
||||
const [{as, user}] = useGlobalState();
|
||||
const [inventoryData, setInventoryData] = useState<InventoryAt[]>([]);
|
||||
const [dataLoading, setDataLoading] = useState(false);
|
||||
const [capacity, setCapacity] = useState<number | undefined>();
|
||||
|
|
@ -69,10 +68,10 @@ export default function BinLevelOverTime(props: Props) {
|
|||
if (fertilizerBin && cap) {
|
||||
cap = cap * 35.239;
|
||||
}
|
||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && cap) {
|
||||
if (user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && cap) {
|
||||
cap = cap / bin.bushelsPerTonne();
|
||||
}
|
||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && cap) {
|
||||
if (user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && cap) {
|
||||
cap = cap / (bin.bushelsPerTonne()*0.907);
|
||||
}
|
||||
setCapacity(cap);
|
||||
|
|
@ -89,10 +88,10 @@ export default function BinLevelOverTime(props: Props) {
|
|||
let bushels = hist.settings.inventory.grainBushels ?? 0;
|
||||
if (bushels !== lastBushels) {
|
||||
let grainDisplay = bushels
|
||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1){
|
||||
if(user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1){
|
||||
grainDisplay = Math.round((bushels / bin.bushelsPerTonne()) * 100) / 100;
|
||||
}
|
||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1){
|
||||
if(user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1){
|
||||
grainDisplay = Math.round((bushels / (bin.bushelsPerTonne()*0.907)) * 100) / 100;
|
||||
}
|
||||
let newData: InventoryAt = {
|
||||
|
|
@ -121,10 +120,10 @@ export default function BinLevelOverTime(props: Props) {
|
|||
if (data.length === 0) {
|
||||
let bushels = bin.bushels();
|
||||
let grainDisplay = bushels
|
||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1){
|
||||
if(user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1){
|
||||
grainDisplay = Math.round((bushels / bin.bushelsPerTonne()) * 100) / 100;
|
||||
}
|
||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1){
|
||||
if(user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1){
|
||||
grainDisplay = Math.round((bushels / (bin.bushelsPerTonne()*0.907)) * 100) / 100;
|
||||
}
|
||||
data.push({
|
||||
|
|
@ -156,10 +155,10 @@ export default function BinLevelOverTime(props: Props) {
|
|||
if (fertilizerBin && cap) {
|
||||
cap = cap * 35.239;
|
||||
}
|
||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && cap) {
|
||||
if (user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && cap) {
|
||||
cap = cap / bin.bushelsPerTonne();
|
||||
}
|
||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && cap) {
|
||||
if (user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && cap) {
|
||||
cap = cap / (bin.bushelsPerTonne()*0.907);
|
||||
}
|
||||
setCapacity(cap);
|
||||
|
|
@ -180,10 +179,10 @@ export default function BinLevelOverTime(props: Props) {
|
|||
if (val.values[0] && m.timestamps[i]) {
|
||||
if (lastBushels !== val.values[0]) {
|
||||
let grainDisplay = val.values[0]
|
||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1){
|
||||
if(user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1){
|
||||
grainDisplay = Math.round((grainDisplay / bin.bushelsPerTonne()) * 100) / 100;
|
||||
}
|
||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1){
|
||||
if(user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1){
|
||||
grainDisplay = Math.round((grainDisplay / (bin.bushelsPerTonne()*0.907)) * 100) / 100;
|
||||
}
|
||||
autoBarData.push({
|
||||
|
|
@ -199,10 +198,10 @@ export default function BinLevelOverTime(props: Props) {
|
|||
let bushels = bin.bushels();
|
||||
let currentTime = moment().valueOf();
|
||||
let grainDisplay = bushels
|
||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1){
|
||||
if(user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1){
|
||||
grainDisplay = Math.round((bushels / bin.bushelsPerTonne()) * 100) / 100;
|
||||
}
|
||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1){
|
||||
if(user.grainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1){
|
||||
grainDisplay = Math.round((bushels / (bin.bushelsPerTonne()*0.907)) * 100) / 100;
|
||||
}
|
||||
autoBarData.push({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue