parent
262afbec3a
commit
63a649a8a1
@ -0,0 +1,25 @@
|
|||||||
|
const calculateMoneyLost = (data) => {
|
||||||
|
const start_seconds = new Date(data.start_time).getTime();
|
||||||
|
const end_seconds = new Date().getTime();
|
||||||
|
const difference = end_seconds-start_seconds;
|
||||||
|
|
||||||
|
const microSecondlyPay = 100000/50/40/60/60/1000
|
||||||
|
return microSecondlyPay*difference*data.num_participants;
|
||||||
|
}
|
||||||
|
|
||||||
|
const getData = async () => {
|
||||||
|
const id = parseInt(window.location.pathname.split('/')[1])
|
||||||
|
const response = await fetch('/meetings/'+id)
|
||||||
|
const data = await response.json();
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
const data = await getData();
|
||||||
|
const moneyLost = calculateMoneyLost(data)
|
||||||
|
document.querySelector('dd:nth-of-type(1)').innerHTML = data.num_participants
|
||||||
|
document.querySelector('dd:nth-of-type(2)').innerHTML = data.start_time
|
||||||
|
document.querySelector('dd:nth-of-type(3)').innerHTML = data.end_time ? data.end_time : 'Still losing money...'
|
||||||
|
document.querySelector('dd:nth-of-type(4)').innerHTML = moneyLost
|
||||||
|
}
|
||||||
|
setInterval(main,1000)
|
||||||
@ -1,10 +1,23 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title></title>
|
<title></title>
|
||||||
</head>
|
<script defer src="{{url_for('static', filename='app.js')}}"></script>
|
||||||
<body>
|
</head>
|
||||||
<h1>How Much Time Have We Wasted?</h1>
|
<body>
|
||||||
</body>
|
<h1>How Much Money Have We Wasted?</h1>
|
||||||
|
<dl>
|
||||||
|
<dt>Number of Participants</dt>
|
||||||
|
<dd></dd>
|
||||||
|
<dt>Start Time</dt>
|
||||||
|
<dd></dd>
|
||||||
|
<dt>End Time</dt>
|
||||||
|
<dd></dd>
|
||||||
|
<dt>
|
||||||
|
Amount of Money Wasted<br/>
|
||||||
|
(assuming an average salary of 100K)
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Loading…
Reference in new issue