Initial cut - untested.
This commit is contained in:
@@ -31,15 +31,15 @@ const cssEditorField = {
|
||||
minWidth: '10rem'
|
||||
}
|
||||
|
||||
const Statistics = () => {
|
||||
const Statistics = async () => {
|
||||
const [selectedMissingAsset, setSelectedMissingAsset] = useState("")
|
||||
|
||||
const {assetStatistics} = useTracker(() => {
|
||||
const {assetStatistics} = useTracker(async () => {
|
||||
let assetStatistics = []
|
||||
const assetTypes = AssetTypes.find({}, {year: 1}).fetch()
|
||||
const assetTypes = await AssetTypes.find({}, {year: 1}).fetchAsync()
|
||||
|
||||
for(let type of assetTypes) {
|
||||
let count = Assets.find({assetTypeId: type._id, condition: {$in: functionalConditions}}).count()
|
||||
let count = await Assets.find({assetTypeId: type._id, condition: {$in: functionalConditions}}).countAsync()
|
||||
|
||||
if(count > 0) {
|
||||
assetStatistics.push({name: type.name, count})
|
||||
@@ -49,13 +49,13 @@ const Statistics = () => {
|
||||
return {assetStatistics}
|
||||
})
|
||||
|
||||
const {missingAssets} = useTracker(() => {
|
||||
const {missingAssets} = useTracker(async () => {
|
||||
let missingAssets = [];
|
||||
|
||||
missingAssets = Assets.find({condition: 'Missing'}).fetch();
|
||||
missingAssets = await Assets.find({condition: 'Missing'}).fetchAsync();
|
||||
|
||||
for(let next of missingAssets) {
|
||||
next.assetType = AssetTypes.findOne({_id: next.assetTypeId})
|
||||
next.assetType = await AssetTypes.findOneAsync({_id: next.assetTypeId})
|
||||
}
|
||||
|
||||
return {missingAssets}
|
||||
|
||||
Reference in New Issue
Block a user