From 88704e8303a80ed71eeb388e2cdec926d37fb3ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BB=D0=B0=D0=B4=D0=B8=D0=BC=D0=B8=D1=80=20=D0=A2?= =?UTF-8?q?=D0=BE=D0=BF=D0=BE=D1=80=D0=BA=D0=BE=D0=B2?= Date: Wed, 16 Jul 2025 13:42:14 +0300 Subject: [PATCH 01/10] Visual bugs fixed --- frontend/css/media.css | 7 +++++++ frontend/css/style.css | 6 ++++++ frontend/js/script.js | 31 +++++++------------------------ 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/frontend/css/media.css b/frontend/css/media.css index e91e313..184d964 100644 --- a/frontend/css/media.css +++ b/frontend/css/media.css @@ -84,6 +84,7 @@ } .news__info { + height: 41vh; font-size: 20px; } } @@ -97,6 +98,11 @@ .graph__block { height: auto; } + + .news__info { + height: 32vh; + font-size: 20px; + } } @media (max-width: 975px) { @@ -105,6 +111,7 @@ } .news__info { + height: 600px; font-size: 16px; } diff --git a/frontend/css/style.css b/frontend/css/style.css index 802adee..b94316a 100644 --- a/frontend/css/style.css +++ b/frontend/css/style.css @@ -286,11 +286,17 @@ span { .news__info { width: 94%; + height: 46vh; text-align: center; font-size: 24px; line-height: 120%; letter-spacing: 1px; color: var(--white); + overflow-y: scroll; +} + +.news__info::-webkit-scrollbar { + display: none; } .news__date { diff --git a/frontend/js/script.js b/frontend/js/script.js index 921cf7b..50c9791 100644 --- a/frontend/js/script.js +++ b/frontend/js/script.js @@ -82,16 +82,6 @@ document.addEventListener("DOMContentLoaded", () => { } } - function shortNumberFormat(num) { - if (selectedMetal === 'zinc') { - return num.toFixed(4); - } - - if (Math.abs(num) >= 1e6) return (num / 1e6).toFixed(1) + 'M'; - if (Math.abs(num) >= 1e3) return (num / 1e3).toFixed(1) + 'K'; - return num.toFixed(1); - } - function getYAxisOptions() { if (window.innerWidth <= 768) { return { @@ -104,9 +94,7 @@ document.addEventListener("DOMContentLoaded", () => { else { return { ticks: { - callback: function(value) { - return shortNumberFormat(value); - } + display: true } }; } @@ -327,6 +315,9 @@ document.addEventListener("DOMContentLoaded", () => { } } + // Initialize prediction button availability for gold (default metal) + setPredictedButtonAvailability(true); + document.querySelectorAll('[data-metal]').forEach(button => { button.addEventListener('click', async () => { selectedMetal = button.dataset.metal; @@ -543,27 +534,21 @@ function getFallbackNews(metal) { async function updateNewsContent() { const swiperWrapper = document.querySelector('.swiper-wrapper'); - // Show loading state swiperWrapper.innerHTML = '

Loading news...

'; try { - // Fetch news from backend const newsData = await fetchNewsFromBackend(selectedMetal); swiperWrapper.innerHTML = ''; - - // Helper to render news with ellipsis and link function renderNewsText(newsItem) { let text = newsItem.preview || newsItem.title; - if (text && text.trim().endsWith('...') && newsItem.url) { - // Remove the last ... and add link on a new line - text = text.replace(/\.\.\.$/, '...
More details here'); + if (selectedMetal !== 'silver' && newsItem.url) { + text = text + '
More details'; } return text; } if (newsData.length === 0) { - // Try fallback news for metals without backend data const fallbackData = getFallbackNews(selectedMetal); if (fallbackData.length > 0) { fallbackData.slice(0, 4).forEach(newsItem => { @@ -586,7 +571,6 @@ async function updateNewsContent() { swiperWrapper.appendChild(slide); }); } else { - // Show no news message const slide = document.createElement('div'); slide.className = 'swiper-slide'; slide.innerHTML = ` @@ -602,7 +586,6 @@ async function updateNewsContent() { swiperWrapper.appendChild(slide); } } else { - // Display real news from backend, limit to 4 newsData.slice(0, 4).forEach(newsItem => { const slide = document.createElement('div'); slide.className = 'swiper-slide'; @@ -622,7 +605,7 @@ async function updateNewsContent() { if (swiper) { swiper.update(); - swiper.slideTo(0, 0); // Go to the first slide instantly + swiper.slideTo(0, 0); } } catch (error) { console.error("Error updating news content:", error); From 57e224b0794fbbded06d592b393a87436b8d2973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BB=D0=B0=D0=B4=D0=B8=D0=BC=D0=B8=D1=80=20=D0=A2?= =?UTF-8?q?=D0=BE=D0=BF=D0=BE=D1=80=D0=BA=D0=BE=D0=B2?= Date: Wed, 16 Jul 2025 14:16:25 +0300 Subject: [PATCH 02/10] News height fix --- frontend/css/media.css | 7 ------- frontend/css/style.css | 6 +++++- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/frontend/css/media.css b/frontend/css/media.css index 184d964..e91e313 100644 --- a/frontend/css/media.css +++ b/frontend/css/media.css @@ -84,7 +84,6 @@ } .news__info { - height: 41vh; font-size: 20px; } } @@ -98,11 +97,6 @@ .graph__block { height: auto; } - - .news__info { - height: 32vh; - font-size: 20px; - } } @media (max-width: 975px) { @@ -111,7 +105,6 @@ } .news__info { - height: 600px; font-size: 16px; } diff --git a/frontend/css/style.css b/frontend/css/style.css index b94316a..6711f08 100644 --- a/frontend/css/style.css +++ b/frontend/css/style.css @@ -286,7 +286,7 @@ span { .news__info { width: 94%; - height: 46vh; + height: 70%; text-align: center; font-size: 24px; line-height: 120%; @@ -311,6 +311,10 @@ span { right: -21px; } +.swiper-slide>div { + height: inherit; +} + /* Graph */ .graph { From 3240eed3f04981cfb3f623c437b808cb2f1545cd Mon Sep 17 00:00:00 2001 From: Spectre113 <132831053+Spectre113@users.noreply.github.com> Date: Wed, 16 Jul 2025 17:50:25 +0300 Subject: [PATCH 03/10] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c46fbc5..1b2c921 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ Follow the steps below to run the project locally using Docker or manually. ### ⚙️ Prerequisites - [Docker](https://www.docker.com/products/docker-desktop) installed and running +- [PostgreSQL](https://www.postgresql.org/) installed. - Python 3.10+ - (Optional) Live server if running without Docker From 51aa8037cd019be90b5df3edef55019dd5ec19b6 Mon Sep 17 00:00:00 2001 From: Spectre113 <132831053+Spectre113@users.noreply.github.com> Date: Wed, 16 Jul 2025 20:43:06 +0300 Subject: [PATCH 04/10] Update .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 55d3b6c..3715487 100644 --- a/.gitignore +++ b/.gitignore @@ -129,7 +129,7 @@ celerybeat.pid *.sage.py # Environments - +.env .venv env/ venv/ From 269499e1ae59168c1596c4aa3135019171c73813 Mon Sep 17 00:00:00 2001 From: Spectre113 <132831053+Spectre113@users.noreply.github.com> Date: Wed, 16 Jul 2025 20:43:20 +0300 Subject: [PATCH 05/10] Delete .env --- .env | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .env diff --git a/.env b/.env deleted file mode 100644 index e38ef75..0000000 --- a/.env +++ /dev/null @@ -1,5 +0,0 @@ -DB_NAME=metalytics -DB_USER=postgres -DB_PASSWORD=postgres -DB_HOST=localhost -DB_PORT=5432 \ No newline at end of file From 7fa9380b8457cccb128ef5498625284b62a68ce8 Mon Sep 17 00:00:00 2001 From: Spectre113 <132831053+Spectre113@users.noreply.github.com> Date: Wed, 16 Jul 2025 20:44:54 +0300 Subject: [PATCH 06/10] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1b2c921..730c1b7 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,8 @@ In your terminal: ```bash git clone https://github.com/IU-Capstone-Project-2025/Metalytics.git cd Metalytics +echo "DB_USER=postgres" > .env +echo "DB_PASSWORD=postgres" >> .env ``` ### 💻 Step 2 — Run with Docker (Recommended) From 3063a1f226e80a152a15d9b2808c142016846a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BB=D0=B0=D0=B4=D0=B8=D0=BC=D0=B8=D1=80=20=D0=A2?= =?UTF-8?q?=D0=BE=D0=BF=D0=BE=D1=80=D0=BA=D0=BE=D0=B2?= Date: Wed, 16 Jul 2025 20:53:31 +0300 Subject: [PATCH 07/10] JS fixed for silver --- frontend/js/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/js/script.js b/frontend/js/script.js index 50c9791..18ed471 100644 --- a/frontend/js/script.js +++ b/frontend/js/script.js @@ -322,7 +322,7 @@ document.addEventListener("DOMContentLoaded", () => { button.addEventListener('click', async () => { selectedMetal = button.dataset.metal; activeMetal(); - if (selectedMetal === 'silver' || selectedMetal === 'zinc') { + if (selectedMetal === 'zinc') { selectedDate = 'day'; setPredictedButtonAvailability(false); document.querySelectorAll('.graph__button[data-interval]').forEach(btn => { @@ -334,7 +334,7 @@ document.addEventListener("DOMContentLoaded", () => { fetchData('day'); } - else if (selectedMetal === 'gold') { + else if (selectedMetal === 'gold' || selectedMetal === 'silver') { selectedDate = 'day'; setPredictedButtonAvailability(true); document.querySelectorAll('.graph__button[data-interval]').forEach(btn => { From 429e9c41a6330ad0c8bae03e1636f99a8049597b Mon Sep 17 00:00:00 2001 From: Spectre113 <132831053+Spectre113@users.noreply.github.com> Date: Thu, 17 Jul 2025 17:56:29 +0300 Subject: [PATCH 08/10] Update ci.yml --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a6c1636..7239135 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,8 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements.txt + pip install pytest + pip install -e . - name: Linting run: flake8 . --exclude=baseline_model,data,__pycache__ - name: Run tests From 038e63560eb85c6daee72f31c4c816cfa9b9689c Mon Sep 17 00:00:00 2001 From: Spectre113 <132831053+Spectre113@users.noreply.github.com> Date: Thu, 17 Jul 2025 18:00:08 +0300 Subject: [PATCH 09/10] Update requirements.txt --- backend/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/requirements.txt b/backend/requirements.txt index 48ddbd4..a680792 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -4,5 +4,5 @@ python-dotenv yfinance psutil uvicorn - -flake8 \ No newline at end of file +pytest +flake8 From 140de854b9b49010d25f7be665f07c002df2a2f1 Mon Sep 17 00:00:00 2001 From: Spectre113 <132831053+Spectre113@users.noreply.github.com> Date: Thu, 17 Jul 2025 18:02:50 +0300 Subject: [PATCH 10/10] Update ci.yml --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7239135..a6c1636 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,8 +22,6 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements.txt - pip install pytest - pip install -e . - name: Linting run: flake8 . --exclude=baseline_model,data,__pycache__ - name: Run tests