Skip to content

feat: implement dynamic project statistics section#122

Merged
komalharshita merged 2 commits into
komalharshita:mainfrom
SATYAM-PRATIBHAN:feat/dynamic-stats-responsiveness
May 17, 2026
Merged

feat: implement dynamic project statistics section#122
komalharshita merged 2 commits into
komalharshita:mainfrom
SATYAM-PRATIBHAN:feat/dynamic-stats-responsiveness

Conversation

@SATYAM-PRATIBHAN
Copy link
Copy Markdown
Contributor

Summary [required]

Implemented a dynamic statistics section on the homepage to provide users with an immediate overview of the project repository.

Related Issue [required]

Closes #26

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
utils/data_loader.py Implemented get_project_stats() to dynamically calculate metrics from the project dataset.
routes/main_routes.py Updated the index route to fetch and pass project statistics to the homepage template.
templates/index.html Integrated a hero-section stat strip and a dedicated responsive statistics grid section.
static/style.css Added comprehensive styling for statistics cards, including hover effects and responsive breakpoints.

How to Test This PR [required]

  1. Clone this branch: git checkout feat/dynamic-stats-responsiveness
  2. Install dependencies: pip install -r requirements.txt
  3. Run the app: python app.py
  4. Open http://127.0.0.1:5000 and verify that the "Real Projects", "Skill Categories", and "Beginner Friendly" stats are visible and correct.
  5. Resize the browser to mobile width (375px) to ensure the stats grid stacks vertically.
  6. Run the tests: python tests/test_basic.py

Expected test output:

27 passed, 0 failed out of 27 tests

Test Results [required]

  PASS  test_projects_json_loads
  PASS  test_each_project_has_required_fields
  PASS  test_find_project_by_id_found
  PASS  test_find_project_by_id_missing
  PASS  test_parse_skills_basic
  PASS  test_parse_skills_empty_string
  PASS  test_parse_skills_single_entry
  PASS  test_score_single_project_full_match
  PASS  test_score_single_project_no_match
  PASS  test_get_recommendations_returns_results
  PASS  test_get_recommendations_max_three
  PASS  test_get_recommendations_no_match_returns_empty
  PASS  test_get_recommendations_result_format
  PASS  test_validate_all_valid
  PASS  test_validate_missing_skills
  PASS  test_validate_missing_level
  PASS  test_validate_missing_interest
  PASS  test_validate_missing_time
  PASS  test_validate_all_missing
  PASS  test_home_route
  PASS  test_recommend_api_valid
  PASS  test_recommend_api_missing_field
  PASS  test_recommend_api_empty_body
  PASS  test_project_detail_found
  PASS  test_project_detail_not_found
  FAIL  test_view_code_found: (Unrelated: Missing starter_code files)
  FAIL  test_download_code_found: (Unrelated: Missing starter_code files)

25 passed, 2 failed out of 27 tests

Screenshots (if UI change)

| Before |
Screenshot 2026-05-16 at 00 04 04
| After |
Screenshot 2026-05-16 at 00 03 31

Self-Review Checklist [required]

  • I have read CONTRIBUTING.md and followed all guidelines
  • My branch name follows the convention: feat/dynamic-stats-responsiveness
  • I have run python tests/test_basic.py and logic-related tests pass
  • I have run flake8 . locally and there are no errors
  • I have not introduced any print() or console.log() debug statements
  • Every new function I wrote has a docstring
  • I have not modified files outside the scope of the linked issue
  • If I changed the UI, I tested it at 375px (mobile) and 1280px (desktop)
  • If I added a project to the dataset, it has all required JSON fields

Notes for Reviewer

The two test failures (test_view_code_found and test_download_code_found) are existing environment issues due to missing files in the starter_code/ directory and are unrelated to the changes in this PR. All core logic and UI routing tests for the homepage and statistics passed successfully.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 15, 2026

@SATYAM-PRATIBHAN 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.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Thank you for submitting your first pull request to DevPath.

Before review:

  • Complete the PR template fully
  • Ensure all tests pass
  • Link your PR to an issue
  • Keep changes scoped to the issue

A maintainer will review your contribution soon.

@SATYAM-PRATIBHAN
Copy link
Copy Markdown
Contributor Author

@komalharshita please do review and tell me if need some changes, so that we can close this issue ASAP.

Copy link
Copy Markdown
Owner

@komalharshita komalharshita left a comment

Choose a reason for hiding this comment

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

Thank you for the detailed implementation and for keeping the changes well-scoped. This is a strong feature contribution overall — especially the backend integration, responsive handling, and dynamic rendering approach.

I reviewed the feature carefully and there are two important improvements needed before merge:

  1. The metric labelled as “Skill Categories” is currently calculated using the count of unique skills/technologies:
len(all_skills)

This does not actually represent categories. Please either:

  • rename the label to something more accurate like “Unique Skills”, “Technologies”, or “Skills Covered”
    OR
  • implement proper category grouping logic.
  1. The statistics now appear twice on the homepage:
  • once in the hero stat strip,
  • and again in the new statistics cards section.

This creates visual duplication and weakens hierarchy. Please refine the UX by either:

  • replacing the existing hero stats,
  • removing the duplicate section,
  • or ensuring both sections present different information.

Once these improvements are addressed, this PR will be in a much stronger state for merge.

@SATYAM-PRATIBHAN
Copy link
Copy Markdown
Contributor Author

@komalharshita you can check the changes now

Copy link
Copy Markdown
Owner

@komalharshita komalharshita left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the requested changes.

The statistics labeling is now accurate, and removing the duplicated hero stat strip significantly improves the page hierarchy and overall UX. The implementation feels much cleaner and more polished after the revisions.

The dynamic stats section is responsive, well-structured, and integrates nicely with the existing design system.

Looks good to merge now.

@komalharshita komalharshita merged commit 4e965b4 into komalharshita:main May 17, 2026
7 of 8 checks passed
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.

Add project statistics section on homepage

2 participants