Initial cut - untested.

This commit is contained in:
2025-09-25 09:31:02 -07:00
parent 7a0666cc6c
commit 3775522265
33 changed files with 351 additions and 346 deletions

View File

@@ -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}