diff --git a/.env.example b/.env.example index 4d717ca..9fb78ce 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,4 @@ API_KEY_8080=secret8080 API_KEY_8081=secret8081 API_KEY_8082=secret8082 +DATABASE_URL=postgres://mi_usuario:mi_password_seguro@db:5432/joinproject_db \ No newline at end of file diff --git a/.github/scripts/depth_conditional_nesting_GP.py b/.github/scripts/depth_conditional_nesting_GP.py index d76f147..202727e 100644 --- a/.github/scripts/depth_conditional_nesting_GP.py +++ b/.github/scripts/depth_conditional_nesting_GP.py @@ -85,10 +85,10 @@ def visit_If(self, node: ast.If) -> None: def get_status_code(max_depth: int) -> str: if max_depth > CRITICAL_THRESHOLD: - return "❌ CRITICAL" + return "CRITICAL" if max_depth >= WARNING_THRESHOLD: - return "🚨 WARNING" - return "✅ OK" + return "WARNING" + return "OK" def get_metrics(filepath: Path) -> Optional[Dict[str, Any]]: @@ -144,7 +144,7 @@ def main() -> None: all_results.append({ "file": str(filepath), "avg_depth": metrics["avg"], - "max_depth": metrics["max"], + "max_nesting_depth": metrics["max"], "status_code": metrics["status_code"] }) if metrics["max"] > CRITICAL_THRESHOLD: diff --git a/.github/scripts/fog_comments_indexGP.py b/.github/scripts/fog_comments_indexGP.py index fcd9358..0c4cf57 100644 --- a/.github/scripts/fog_comments_indexGP.py +++ b/.github/scripts/fog_comments_indexGP.py @@ -1,12 +1,10 @@ -import re -import os -import sys -import json -import textstat +import re, os, sys, json, textstat from pathlib import Path SUPPORTED_EXTENSIONS = {'.py', '.js', '.ts', '.cpp', '.java', '.html'} +EXCLUDE_DIRS = {'.git', 'node_modules', 'venv', 'env', '__pycache__', 'dist'} + def extract_comments(file_path): extension = os.path.splitext(file_path)[1] @@ -75,7 +73,7 @@ def scan(target_path): files = ( [path] if path.is_file() - else [f for f in path.rglob('*') if f.suffix in SUPPORTED_EXTENSIONS] + else [f for f in path.rglob('*') if f.suffix in SUPPORTED_EXTENSIONS and not any(part in EXCLUDE_DIRS for part in f.parts)] ) results = [] @@ -92,7 +90,7 @@ def scan(target_path): results.append({ "file": str(file), "avg_fog": round(avg, 1) if avg else None, - "max_fog": round(max_score, 1) if max_score else None, + "fog_score": round(max_score, 1) if max_score else None, "status_code": status }) diff --git a/.github/scripts/render-integrity-html.js b/.github/scripts/render-integrity-html.js index 254b8f9..e2e70f8 100644 --- a/.github/scripts/render-integrity-html.js +++ b/.github/scripts/render-integrity-html.js @@ -164,7 +164,7 @@ function buildQualitySection(key, data) { const results = data.results || [] const totalFiles = (data.summary && data.summary.total_files != null) ? data.summary.total_files : results.length - const violations = results.filter((r) => r.status_code !== 'OK' && r.status_code !== 'OK!') + const violations = results.filter((r) => r.status_code !== 'OK' && r.status_code !== 'OK!' && r.status_code !== 'NO DATA') const passed = totalFiles - violations.length const findingsHtml = violations.length === 0 @@ -172,7 +172,7 @@ function buildQualitySection(key, data) { : violations.map((r) => { const val = r[qm.metric] const display = typeof val === 'number' ? val.toFixed(qm.decimals) : (val ?? '?') - const lvl = (r.status_code === 'DANGER' || r.status_code === '⚠️ IMPROVE NAMING') ? 'error' : 'warning' + const lvl = (r.status_code === 'DANGER' || r.status_code === '⚠️ IMPROVE NAMING' || r.status_code === 'COMPLEX') ? 'error' : 'warning' return `
${chip(lvl)}
@@ -225,7 +225,7 @@ const qualitySummaryRows = quality const qm = QUALITY_META[key] const data = quality[key] const status = qualityJobStatus(data) - const violations = data ? (data.results || []).filter((r) => r.status_code !== 'OK' && r.status_code !== 'OK!').length : 0 + const violations = data ? (data.results || []).filter((r) => r.status_code !== 'OK' && r.status_code !== 'OK!' && r.status_code !== 'NO DATA').length : 0 return ` ${qm.icon} ${esc(qm.name)} diff --git a/.github/workflows/quality-pipeline.yml b/.github/workflows/quality-pipeline.yml index 224ffbc..5aaadf7 100644 --- a/.github/workflows/quality-pipeline.yml +++ b/.github/workflows/quality-pipeline.yml @@ -328,7 +328,7 @@ jobs: - name: Run fog index analysis run: | mkdir -p quality-job4 - python .github/scripts/fog_comments_indexGP.py src/ \ + python .github/scripts/fog_comments_indexGP.py . \ > quality-job4/fog-results.json cat quality-job4/fog-results.json diff --git a/.gitignore b/.gitignore index 53487e7..c139f97 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,4 @@ db.sqlite3 media/ env/ staticfiles/ - +.vscode/ diff --git a/Dockerfile b/Dockerfile index f1728a7..765eebd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,10 @@ -FROM python:3.13-slim +FROM python:3.12-slim WORKDIR /app COPY ./requirements.txt /app/ -RUN pip install -r requirements.txt +RUN pip install --upgrade pip && pip install -r requirements.txt COPY . . @@ -12,7 +12,4 @@ EXPOSE 8000 RUN python manage.py collectstatic --noinput -CMD python3 manage.py migrate && python3 manage.py runserver 0.0.0.0:8000 - - - +CMD python3 manage.py migrate --fake-initial && gunicorn web.wsgi:application --bind 0.0.0.0:${PORT:-8000} --timeout 90 \ No newline at end of file diff --git a/Templates/Details/details_base.html b/Templates/Details/details_base.html index 6258c36..99e5edf 100644 --- a/Templates/Details/details_base.html +++ b/Templates/Details/details_base.html @@ -8,21 +8,28 @@ {% block content %}
@@ -48,51 +69,129 @@

Sinopsis

Acciones

{% if user.is_authenticated %} - {% endif %}
+ +
+

Valoracions de la comunitat

+ +
+ {% if total_reviews > 0 %} + ★ {{ avg_rating|floatformat:1 }} + ({{ total_reviews }}) + {% else %} + Sense valoracions encara + {% endif %} +
+ + {% if user.is_authenticated %} +
+

Deixa la teva opinió

+
+ {% csrf_token %} + +
+ {% for i in "54321" %} + + + {% endfor %} +
+ + + + +
+
+ {% endif %} + +
+ {% for review in reviews %} +
+
+ {{ review.user.username }} + + {% for i in "12345" %} + {% if forloop.counter <= review.puntuacio %}★{% else %}{% endif %} + {% endfor %} + +
+
{{ review.creada_a|date:"d M Y" }}
+ {% if review.comentari %} +

{{ review.comentari }}

+ {% endif %} +
+ {% empty %} +

Sigues el primer en valorar aquest contingut!

+ {% endfor %} +
+
+
✅ Añadido a tu historial
+ {% endblock %} \ No newline at end of file diff --git a/Templates/Details/details_movie.html b/Templates/Details/details_movie.html index 4b0c5ba..ad3b9cc 100644 --- a/Templates/Details/details_movie.html +++ b/Templates/Details/details_movie.html @@ -7,4 +7,26 @@ {% endblock %} -{% block favorite_url %}{% url 'toggle_movie_favorite' content.id %}{% endblock %} \ No newline at end of file +{% block favorite_url %}{% url 'toggle_movie_favorite' content.id %}{% endblock %} + +{% block extra_main_content %} +
+

També et pot agradar...

+
+ {% for rec in recommendations %} + + {% if rec.poster_path %} + {{ rec.title }} + {% else %} +
+ {{ rec.title }} +
+ {% endif %} +

{{ rec.title }}

+
+ {% empty %} +

No hi ha recomanacions disponibles.

+ {% endfor %} +
+
+{% endblock %} \ No newline at end of file diff --git a/Templates/base.html b/Templates/base.html index c7f5a31..9f42415 100644 --- a/Templates/base.html +++ b/Templates/base.html @@ -32,8 +32,6 @@ {% if user.is_authenticated %} {% trans "Welcome" %} {{ user.username }} {% endif %} - -