Small fixes to get started
- docker-compose needs the flag --build to (re)build all containers - Initially, on an empty database, Track.aggregate returns an empty array, which results in an undefined error for /api/stats
This commit is contained in:
parent
840ecc6d6f
commit
e9ea0645c9
13
README.md
13
README.md
|
@ -9,7 +9,16 @@ separated into components:
|
|||
* **frontend**: A React single-page application that allows access to the data,
|
||||
provides summaries and visualizations, and lets users adjust settings and
|
||||
manage and publish their tracks.
|
||||
|
||||
|
||||
## Clone the Project
|
||||
|
||||
First of all, you must clone this project. This project uses submodules,
|
||||
thus ensure, that they are cloned as well:
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
## Deployment setup
|
||||
|
||||
You should be familiar with managing a Linux server. If not, find a suitable
|
||||
|
@ -48,7 +57,7 @@ Compose](https://docs.docker.com/compose/install/) onto your machine, and
|
|||
cloning the repository, all you need to do is:
|
||||
|
||||
```bash
|
||||
docker-compose up -d
|
||||
docker-compose up -d --build
|
||||
```
|
||||
|
||||
If this does not work, please open an issue and describe the problem you're
|
||||
|
|
11702
api/package-lock.json
generated
11702
api/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -14,7 +14,7 @@ router.get(
|
|||
const publicTrackCount = await Track.find({ public: true }).count();
|
||||
const userCount = await User.find().count();
|
||||
|
||||
const [{ trackLength, numEvents, trackDuration }] = await Track.aggregate([
|
||||
const aggregateResult = await Track.aggregate([
|
||||
{
|
||||
$addFields: {
|
||||
trackLength: '$statistics.length',
|
||||
|
@ -39,6 +39,8 @@ router.get(
|
|||
},
|
||||
]);
|
||||
|
||||
const [trackLength, numEvents, trackDuration] = aggregateResult.length > 0 ? aggregateResult : [0,0,0];
|
||||
|
||||
const trackLengthPrivatized = Math.floor(trackLength / TRACK_LENGTH_ROUNDING) * TRACK_LENGTH_ROUNDING;
|
||||
|
||||
return res.json({
|
||||
|
|
Loading…
Reference in a new issue