明树Git Lab
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
letian_backend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zengfanpei
letian_backend
Commits
e358edfe
Commit
e358edfe
authored
Oct 30, 2024
by
zengfanpei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
小数处理 暂无精度要求 avg可用
parent
de2ca538
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
statisticsController.js
controller/statisticsController.js
+17
-1
No files found.
controller/statisticsController.js
View file @
e358edfe
...
...
@@ -54,6 +54,13 @@ async function getSMCChangeTrend(req, res, next) {
// soilPH: { $avg: "$soilPH" },
}
},
{
$project
:
{
soilTemperature
:
{
$round
:
[
"$soilTemperature"
,
2
]},
soilMoisture
:
{
$round
:
[
"$soilMoisture"
,
2
]},
nitrogen
:
{
$round
:
[
"$nitrogen"
,
2
]},
phosphorus
:
{
$round
:
[
"$phosphorus"
,
2
]},
potassium
:
{
$round
:
[
"$potassium"
,
2
]},
}},
{
$sort
:
{
_id
:
1
}
}
];
...
...
@@ -79,6 +86,10 @@ async function getSMCChangeTrend(req, res, next) {
soilConductivity
:
{
$avg
:
"$soilConductivity"
},
}
},
{
$project
:
{
soilPH
:
{
$round
:
[
"$soilPH"
,
2
]},
soilConductivity
:
{
$round
:
[
"$soilConductivity"
,
2
]},
}},
{
$sort
:
{
_id
:
1
}
}
];
...
...
@@ -281,7 +292,12 @@ async function getAreaDistribution(req, res, next) {
latestYield
:
{
$sum
:
"$latestYield"
},
latestYieldValue
:
{
$sum
:
"$latestYieldValue"
},
}
}
},
{
$project
:
{
area
:
{
$round
:
[
"$area"
,
2
]},
latestYield
:
{
$round
:
[
"$latestYield"
,
2
]},
latestYieldValue
:
{
$round
:
[
"$latestYieldValue"
,
2
]},
}},
]);
let
totalArea
=
_
.
sumBy
(
lands
,
'area'
);
let
totalYield
=
_
.
sumBy
(
lands
,
'latestYield'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment