From f8ce2334c6f7109f8b23e03c6e6f8049e46499b3 Mon Sep 17 00:00:00 2001 From: Qstick Date: Mon, 5 Nov 2018 21:57:26 -0500 Subject: [PATCH] Fixed: Downloaded Albums not reflected on Calendar Turns albums green if 100% of tracks are in library Fixes #520 --- frontend/src/Calendar/Agenda/AgendaEvent.js | 7 +++---- frontend/src/Calendar/Events/CalendarEvent.js | 6 +++--- frontend/src/Calendar/getStatusStyle.js | 8 ++++---- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/frontend/src/Calendar/Agenda/AgendaEvent.js b/frontend/src/Calendar/Agenda/AgendaEvent.js index c869b096c..7db3a9958 100644 --- a/frontend/src/Calendar/Agenda/AgendaEvent.js +++ b/frontend/src/Calendar/Agenda/AgendaEvent.js @@ -42,10 +42,9 @@ class AgendaEvent extends Component { artist, title, foreignAlbumId, - albumType, releaseDate, monitored, - // hasFile, + statistics, grabbed, queueItem, showDate, @@ -57,7 +56,7 @@ class AgendaEvent extends Component { // const endTime = startTime.add(artist.runtime, 'minutes'); const downloading = !!(queueItem || grabbed); const isMonitored = artist.monitored && monitored; - const statusStyle = getStatusStyle(id, downloading, startTime, isMonitored); + const statusStyle = getStatusStyle(id, downloading, startTime, isMonitored, statistics.percentOfTracks); return (
@@ -126,7 +125,7 @@ AgendaEvent.propTypes = { albumType: PropTypes.string.isRequired, releaseDate: PropTypes.string.isRequired, monitored: PropTypes.bool.isRequired, - // hasFile: PropTypes.bool.isRequired, + statistics: PropTypes.object.isRequired, grabbed: PropTypes.bool, queueItem: PropTypes.object, showDate: PropTypes.bool.isRequired, diff --git a/frontend/src/Calendar/Events/CalendarEvent.js b/frontend/src/Calendar/Events/CalendarEvent.js index e73b30c93..48d5e4f4d 100644 --- a/frontend/src/Calendar/Events/CalendarEvent.js +++ b/frontend/src/Calendar/Events/CalendarEvent.js @@ -49,7 +49,7 @@ class CalendarEvent extends Component { foreignAlbumId, releaseDate, monitored, - // hasFile, + statistics, grabbed, queueItem, // timeFormat, @@ -64,7 +64,7 @@ class CalendarEvent extends Component { // const endTime = startTime.add(artist.runtime, 'minutes'); const downloading = !!(queueItem || grabbed); const isMonitored = artist.monitored && monitored; - const statusStyle = getStatusStyle(id, downloading, startTime, isMonitored); + const statusStyle = getStatusStyle(id, downloading, startTime, isMonitored, statistics.percentOfTracks); return (
@@ -121,12 +121,12 @@ CalendarEvent.propTypes = { artist: PropTypes.object.isRequired, title: PropTypes.string.isRequired, foreignAlbumId: PropTypes.string.isRequired, + statistics: PropTypes.object.isRequired, // seasonNumber: PropTypes.number.isRequired, // episodeNumber: PropTypes.number.isRequired, // absoluteEpisodeNumber: PropTypes.number, releaseDate: PropTypes.string.isRequired, monitored: PropTypes.bool.isRequired, - // hasFile: PropTypes.bool.isRequired, grabbed: PropTypes.bool, queueItem: PropTypes.object, // timeFormat: PropTypes.string.isRequired, diff --git a/frontend/src/Calendar/getStatusStyle.js b/frontend/src/Calendar/getStatusStyle.js index f46c19fb6..50ea3f64a 100644 --- a/frontend/src/Calendar/getStatusStyle.js +++ b/frontend/src/Calendar/getStatusStyle.js @@ -1,12 +1,12 @@ /* eslint max-params: 0 */ import moment from 'moment'; -function getStatusStyle(episodeNumber, downloading, startTime, isMonitored) { +function getStatusStyle(episodeNumber, downloading, startTime, isMonitored, percentOfTracks) { const currentTime = moment(); - // if (hasFile) { - // return 'downloaded'; - // } + if (percentOfTracks === 100) { + return 'downloaded'; + } if (downloading) { return 'downloading';