generated from csci5117s24/Project-2
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from csci5117s24/dev_final
final optimization
- Loading branch information
Showing
14 changed files
with
201 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,35 +4,34 @@ CSCI 5117, Spring 2024, [assignment description](https://canvas.umn.edu/courses/ | |
|
||
## App Info: | ||
|
||
* Team Name: WASD | ||
* App Name: ??????? | ||
* App Link: <https://TODO.com/> | ||
- Team Name: WASD | ||
- App Name: Health Tracker | ||
- App Link: <https://black-bay-07d1c5410.5.azurestaticapps.net/> | ||
|
||
### Students | ||
|
||
* Maurice Yu, [email protected] | ||
* Dominic Deiman, [email protected] | ||
* Ling Wang, [email protected] | ||
* Salma Abdi, [email protected] | ||
* Stuti Shah, [email protected] | ||
|
||
- Maurice Yu, [email protected] | ||
- Dominic Deiman, [email protected] | ||
- Ling Wang, [email protected] | ||
- Salma Abdi, [email protected] | ||
- Stuti Shah, [email protected] | ||
|
||
## Key Features | ||
|
||
**Describe the most challenging features you implemented | ||
(one sentence per bullet, maximum 4 bullets):** | ||
|
||
* ... | ||
- Using Cloudinary to store user pictures. | ||
- Enabling unit switch for water log. | ||
- Calculating and formatting statistic data. | ||
|
||
Which (if any) device integration(s) does your app support? | ||
|
||
* ... | ||
- Camera | ||
|
||
Which (if any) progressive web app feature(s) does your app support? | ||
|
||
* ... | ||
|
||
|
||
- ... | ||
|
||
## Mockup images | ||
|
||
|
@@ -44,9 +43,7 @@ Which (if any) progressive web app feature(s) does your app support? | |
|
||
**Is there anything special we need to know in order to effectively test your app? (optional):** | ||
|
||
* ... | ||
|
||
|
||
- ... | ||
|
||
## Screenshots of Site (complete) | ||
|
||
|
@@ -55,15 +52,15 @@ along with a very brief caption:** | |
|
||
![](https://media.giphy.com/media/o0vwzuFwCGAFO/giphy.gif) | ||
|
||
|
||
|
||
## External Dependencies | ||
|
||
**Document integrations with 3rd Party code or services here. | ||
Please do not document required libraries (e.g., React, Azure serverless functions, Azure nosql).** | ||
|
||
* Library or service name: description of use | ||
* ... | ||
- cloudinary/react & cloudinary/url-gen: for image storage | ||
- react-chartjs-2: for displaying graphs | ||
- react-liquid-gauge: beautiful UI for displaying progress | ||
- react-loading: for displaying of loading state | ||
|
||
**If there's anything else you would like to disclose about how your project | ||
relied on external code, expertise, or anything else, please disclose that | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const { FindFromMongo } = require('../common/mongo'); | ||
const { FormatDate } = require('../common/utils'); | ||
|
||
const collectionWeightLog = "weightlog"; | ||
const oneDayInMilliSec = 1000 * 24 * 60 * 60; | ||
|
||
module.exports = { | ||
GetWeeklyWeightStats, | ||
} | ||
|
||
|
||
async function GetWeeklyWeightStats(userId, endDateStr) { | ||
let startTime = new Date(endDateStr); | ||
startTime.setDate(startTime.getDate() - 6); | ||
let endTime = new Date(endDateStr); | ||
endTime.setDate(endTime.getDate() + 1); | ||
const weightLogs = await FindFromMongo(collectionWeightLog, {userId: userId, timestamp: {$gte: startTime.getTime(), $lt: endTime.getTime()}}); | ||
return formatStats(startTime, weightLogs); | ||
} | ||
|
||
async function formatStats(startTime, weightLogs) { | ||
let stats = []; | ||
let j = 0; | ||
for (let i = 0; i < 7; i++) { | ||
let theDay = new Date(startTime.toLocaleDateString()); | ||
theDay.setDate(theDay.getDate() + i); | ||
const begin = startTime.getTime() + i * oneDayInMilliSec; | ||
const end = startTime.getTime() + (i+1) * oneDayInMilliSec; | ||
let stat = { | ||
date: FormatDate(theDay), | ||
unit: "kg" | ||
}; | ||
if (j < weightLogs.length && weightLogs[j].timestamp >= begin && weightLogs[j].timestamp < end) { | ||
stat.value = weightLogs[j].value; | ||
stat.unit = weightLogs[j].unit; | ||
j++ | ||
} | ||
stats.push(stat); | ||
} | ||
return stats; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.