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-05-30 16:56:24 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
86697e4e0ee7e04448b63cc1f4ee62f9e8c74d31
86697e4e
1 parent
7546b09a
feat. data process : data type
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
server/src/lib/DataProcess.js
server/src/lib/DataProcess.js
View file @
86697e4
...
...
@@ -44,30 +44,34 @@ const balanceFactoring = (balance) => {
const
slicingBalance
=
max
/
5
;
if
(
parseInt
(
balance
)
<
slicingBalance
||
parseInt
(
balance
)
>
max
*
2
)
return
'100'
;
else
if
(
parseInt
(
balance
)
<
slicingBalance
*
2
)
return
'80'
;
else
if
(
parseInt
(
balance
)
<
slicingBalance
*
3
)
else
if
(
parseInt
(
balance
)
<
slicingBalance
*
2
)
return
'60'
;
else
if
(
parseInt
(
balance
)
<
slicingBalance
*
4
)
else
if
(
parseInt
(
balance
)
<
slicingBalance
*
3
)
return
'40'
;
else
if
(
parseInt
(
balance
)
<
slicingBalance
*
5
)
else
if
(
parseInt
(
balance
)
<
slicingBalance
*
4
)
return
'20'
;
else
return
'0'
;
else
return
'0'
;
}
//bottleId가 포함된 data를 받아서 해당 약병의 data를 업데이트한다.
const
bottleInfoUpdate
=
async
(
data
)
=>
{
const
{
bottleId
,
isOpen
,
openDate
,
temperature
,
humidity
,
balance
}
=
data
;
let
{
bottleId
,
isOpen
,
openDate
,
temperature
,
humidity
,
balance
}
=
data
;
bottleId
=
parseInt
(
bottleId
);
isOpen
=
parseInt
(
isOpen
);
temperature
=
parseFloat
(
temperature
);
humidity
=
parseFloat
(
humidity
);
balance
=
parseInt
(
balance
);
if
(
isOpen
===
'1'
)
{
if
(
isOpen
)
{
await
Bottle
.
findOneAndUpdate
({
bottleId
},
{
recentOpen
:
openDate
});
}
if
(
balance
!==
'-1'
)
{
if
(
balance
!==
-
1
)
{
await
Bottle
.
findOneAndUpdate
({
bottleId
},
{
balance
})
...
...
Please
register
or
login
to post a comment