Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design1
/
RIT_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
박권수
2021-10-19 15:50:49 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
ff3eba875cc977263a9dd9165d1cc1b82310522a
ff3eba87
2 parents
ac0d944e
da160211
Merge branch 'server' into web
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
server/src/models/takeMedicineHistory.js
server/src/util/DataProcess.js
server/src/models/takeMedicineHistory.js
View file @
ff3eba8
...
...
@@ -12,9 +12,10 @@ const TakeMedicineHistorySchema = new Schema ({
ref
:
'BottleMedicine'
,
required
:
true
,
},
temperature
:
{
type
:
Number
,
default
:
0
},
humidity
:
{
type
:
Number
,
default
:
0
},
dosage
:
{
type
:
Number
,
default
:
0
},
temperature
:
{
type
:
Number
,
default
:
0
,
},
humidity
:
{
type
:
Number
,
default
:
0
,
},
dosage
:
{
type
:
Number
,
default
:
0
,
},
balance
:
{
type
:
Number
,
default
:
0
,
},
});
...
...
server/src/util/DataProcess.js
View file @
ff3eba8
...
...
@@ -59,11 +59,14 @@ const bottleInfoUpdate = async(data) => {
const
dosage
=
Math
.
round
((
lastTotalWeight
-
totalWeight
)
/
parseFloat
(
eachWeight
));
if
(
dosage
>
0
)
{
const
balance
=
Math
.
round
(
totalWeight
/
parseFloat
(
eachWeight
));
const
takeMedicineHist
=
new
TakeMedicineHist
({
bmId
:
bottleMedicine
.
_id
,
temperature
,
humidity
,
dosage
,
balance
,
});
await
takeMedicineHist
.
save
();
}
...
...
Please
register
or
login
to post a comment