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
|
|
@ -63,7 +63,7 @@ import {
|
|||
} from "providers";
|
||||
import React, { SetStateAction, useCallback, useEffect, useState } from "react";
|
||||
// import { getThemeType } from "theme";
|
||||
import { getGrainUnit, stringToMaterialColour } from "utils";
|
||||
import { stringToMaterialColour } from "utils";
|
||||
//import InfiniteScroll from "react-infinite-scroller";
|
||||
import PageContainer from "./PageContainer";
|
||||
import ObjectTable from "objects/ObjectTable";
|
||||
|
|
@ -934,7 +934,7 @@ export default function Bins(props: Props) {
|
|||
return " bu";
|
||||
}
|
||||
|
||||
switch (getGrainUnit()) {
|
||||
switch (user.grainUnit()) {
|
||||
case pond.GrainUnit.GRAIN_UNIT_TONNE:
|
||||
return " mT";
|
||||
case pond.GrainUnit.GRAIN_UNIT_TON:
|
||||
|
|
@ -947,9 +947,9 @@ export default function Bins(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)
|
||||
}
|
||||
}
|
||||
|
|
@ -959,9 +959,9 @@ export default function Bins(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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue