Skip to content

Commit

Permalink
fix(api): Save progress with 2 after ,
Browse files Browse the repository at this point in the history
  • Loading branch information
TriPSs committed Sep 30, 2020
1 parent f89a12e commit 0bb8187
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
7 changes: 5 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Example .env file. Please fill in the values.

# Port to run this server on
PORT=5000
# Port to run the api on
API_PORT=5000

# Port to run the scraper on
SCRAPER_PORT=5001

# The name of the MongoDB database, must be same as scraper.
MONGO_DATABASE=popcorn-api-development
Expand Down
10 changes: 4 additions & 6 deletions apps/api/src/downloads/downloads.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export class DownloadsResolver {
* @param {Download} download - The download to fetch the movie for
*/
@ResolveField(type => Movie, { description: 'The movie of this download, only if itemType === "movie"' })
movie(@Parent() download) {
movie(@Parent() download): Promise<Movie> {
if (download.itemType !== 'movie') {
return null
}
Expand All @@ -184,11 +184,9 @@ export class DownloadsResolver {

/**
* Fetch the episode of this download
*
* @param {Download} download - The download to fetch the episode for
*/
@ResolveField(type => Episode, { description: 'The episode of this download, only if itemType === "episode"' })
episode(@Parent() download) {
episode(@Parent() download: Download): Promise<Episode> {
if (download.itemType !== 'episode') {
return null
}
Expand All @@ -202,7 +200,7 @@ export class DownloadsResolver {
* @param {Download} download - The download to format it on
*/
@ResolveField(type => String)
speed(@Parent() download) {
speed(@Parent() download): string {
return formatKbToString(download.speed)
}

Expand All @@ -212,7 +210,7 @@ export class DownloadsResolver {
* @param {Download} download - The download to format it on
*/
@ResolveField(type => String)
timeRemaining(@Parent() download) {
timeRemaining(@Parent() download): string {
return formatMsToRemaining(download.timeRemaining)
}

Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/shared/torrent/torrent.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ export class TorrentService {

// Update the item
await this.updateOne(download, {
progress: newProgress.toFixed(1),
progress: newProgress.toFixed(2),
status: TorrentService.STATUS_DOWNLOADING,
timeRemaining: torrent.timeRemaining,
speed: torrent.downloadSpeed,
Expand Down

0 comments on commit 0bb8187

Please sign in to comment.