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:35 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
da1602119fd9ea6bf4bc374e34341c83dca3a39d
da160211
1 parent
f44c1519
fix. takeMedicineHists : balance(잔량) 필드 추가
Hide 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 @
da16021
...
...
@@ -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 @
da16021
...
...
@@ -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