From e144c1627a8c06cf1b6b09fb2780948d14778462 Mon Sep 17 00:00:00 2001 From: Son Nguyen Date: Fri, 21 Jun 2024 23:46:54 +0700 Subject: [PATCH] Update: Add context referencing for chatbot (#196) --- MovieVerse-Frontend/js/movie-details.js | 11 ++++++++--- .../www/MovieVerse-Frontend/js/movie-details.js | 11 ++++++++--- .../ios/www/MovieVerse-Frontend/js/movie-details.js | 11 ++++++++--- .../www/MovieVerse-Frontend/js/movie-details.js | 11 ++++++++--- 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/MovieVerse-Frontend/js/movie-details.js b/MovieVerse-Frontend/js/movie-details.js index c435d97f..5d9e8acf 100644 --- a/MovieVerse-Frontend/js/movie-details.js +++ b/MovieVerse-Frontend/js/movie-details.js @@ -1639,9 +1639,14 @@ function createImdbRatingCircle(imdbRating, imdbId) { if (imdbRating === 'N/A' || imdbRating === null || imdbRating === undefined) { imdbRating = 'N/A'; } - - if (imdbRating === 'N/A') { - imdbRating = imdbRating.toFixed(1); + else { + imdbRating = parseFloat(imdbRating); + if (!isNaN(imdbRating)) { + imdbRating = imdbRating.toFixed(1); + } + else { + imdbRating = 'N/A'; + } } let circleContainer = document.getElementById('imdbRatingCircleContainer'); diff --git a/MovieVerse-Mobile/platforms/android/app/src/main/assets/www/MovieVerse-Frontend/js/movie-details.js b/MovieVerse-Mobile/platforms/android/app/src/main/assets/www/MovieVerse-Frontend/js/movie-details.js index c435d97f..5d9e8acf 100644 --- a/MovieVerse-Mobile/platforms/android/app/src/main/assets/www/MovieVerse-Frontend/js/movie-details.js +++ b/MovieVerse-Mobile/platforms/android/app/src/main/assets/www/MovieVerse-Frontend/js/movie-details.js @@ -1639,9 +1639,14 @@ function createImdbRatingCircle(imdbRating, imdbId) { if (imdbRating === 'N/A' || imdbRating === null || imdbRating === undefined) { imdbRating = 'N/A'; } - - if (imdbRating === 'N/A') { - imdbRating = imdbRating.toFixed(1); + else { + imdbRating = parseFloat(imdbRating); + if (!isNaN(imdbRating)) { + imdbRating = imdbRating.toFixed(1); + } + else { + imdbRating = 'N/A'; + } } let circleContainer = document.getElementById('imdbRatingCircleContainer'); diff --git a/MovieVerse-Mobile/platforms/ios/www/MovieVerse-Frontend/js/movie-details.js b/MovieVerse-Mobile/platforms/ios/www/MovieVerse-Frontend/js/movie-details.js index c435d97f..5d9e8acf 100644 --- a/MovieVerse-Mobile/platforms/ios/www/MovieVerse-Frontend/js/movie-details.js +++ b/MovieVerse-Mobile/platforms/ios/www/MovieVerse-Frontend/js/movie-details.js @@ -1639,9 +1639,14 @@ function createImdbRatingCircle(imdbRating, imdbId) { if (imdbRating === 'N/A' || imdbRating === null || imdbRating === undefined) { imdbRating = 'N/A'; } - - if (imdbRating === 'N/A') { - imdbRating = imdbRating.toFixed(1); + else { + imdbRating = parseFloat(imdbRating); + if (!isNaN(imdbRating)) { + imdbRating = imdbRating.toFixed(1); + } + else { + imdbRating = 'N/A'; + } } let circleContainer = document.getElementById('imdbRatingCircleContainer'); diff --git a/MovieVerse-Mobile/www/MovieVerse-Frontend/js/movie-details.js b/MovieVerse-Mobile/www/MovieVerse-Frontend/js/movie-details.js index c435d97f..5d9e8acf 100644 --- a/MovieVerse-Mobile/www/MovieVerse-Frontend/js/movie-details.js +++ b/MovieVerse-Mobile/www/MovieVerse-Frontend/js/movie-details.js @@ -1639,9 +1639,14 @@ function createImdbRatingCircle(imdbRating, imdbId) { if (imdbRating === 'N/A' || imdbRating === null || imdbRating === undefined) { imdbRating = 'N/A'; } - - if (imdbRating === 'N/A') { - imdbRating = imdbRating.toFixed(1); + else { + imdbRating = parseFloat(imdbRating); + if (!isNaN(imdbRating)) { + imdbRating = imdbRating.toFixed(1); + } + else { + imdbRating = 'N/A'; + } } let circleContainer = document.getElementById('imdbRatingCircleContainer');