Skip to content

Fix/use before declare errors - #1335

Open
chirag-projects wants to merge 3 commits into
komalharshita:mainfrom
chirag-projects:fix/use-before-declare-errors
Open

Fix/use before declare errors#1335
chirag-projects wants to merge 3 commits into
komalharshita:mainfrom
chirag-projects:fix/use-before-declare-errors

Conversation

@chirag-projects

Copy link
Copy Markdown

Summary [required]

This PR resolves critical JavaScript and template rendering errors that were blocking core functionality. A syntax error in the error handling logic and an unresolved merge conflict in the project detail template were preventing the application from loading properly. These fixes restore full interactivity to the recommendation engine and project detail pages, with all 78 tests now passing.

Related Issue [required]

Closes #1283

Type of Change [required]

  • Bug fix — resolves a broken behaviour
  • Feature — adds new functionality
  • Data — adds new projects to data/projects.json
  • Documentation — updates docs, README, or code comments only
  • Style — CSS or visual changes only, no logic change
  • Refactor — restructures code without changing behaviour
  • Test — adds or updates tests

What Was Changed [required]

File Change made
static/script.js Fixed missing parentheses in if condition (line 1091) — properly grouped complex boolean expression with mixed && and `
templates/project.html Resolved git merge conflict — replaced non-existent escapejs filter with built-in tojson filter for safe JavaScript variable serialization

How to Test This PR [required]

  1. Clone this branch: git checkout your-branch-name
  2. Install dependencies: pip install -r requirements.txt
  3. Run the app: python app.py
  4. Open http://127.0.0.1:5000 and...
  5. Run the tests: python tests/test_basic.py

Expected test output:

78 passed, 0 failed out of 78 tests

Test Results [required]

PASS test_projects_json_loads
PASS test_duplicate_ids_detected
...
PASS test_project_detail_found
PASS test_project_detail_not_found
PASS test_project_links_have_noopener
PASS test_compare_api_not_found
PASS test_sitemap_includes_compare

78 passed, 0 failed out of 78 tests

Screenshots (if UI change)

Before After
Console error: SyntaxError: missing ) after argument list No console errors, full script execution
Template error: TemplateAssertionError: No filter named 'escapejs' Project detail page renders correctly
UI elements non-functional All interactive elements working

Self-Review Checklist [required]

  • I have read CONTRIBUTING.md and followed all guidelines
  • My branch name follows the convention: feat/, fix/, docs/, data/, style/, test/
  • I have run python tests/test_basic.py and all 78 tests pass
  • I have run flake8 . locally and there are no errors
  • I have not introduced any print() or console.log() debug statements

Copilot AI review requested due to automatic review settings July 25, 2026 15:22
@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

@chirag-projects is attempting to deploy a commit to the komalsony234-1530's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added gssoc-2026 type:bug Something isn't working labels Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Frontend syntax error breaks navbar on landing page

2 participants