Skip to content

Fix/issue 6 - #208

Closed
EHEGUY wants to merge 2 commits into
komalharshita:mainfrom
EHEGUY:fix/issue-6
Closed

Fix/issue 6#208
EHEGUY wants to merge 2 commits into
komalharshita:mainfrom
EHEGUY:fix/issue-6

Conversation

@EHEGUY

@EHEGUY EHEGUY commented May 17, 2026

Copy link
Copy Markdown
Contributor

Summary [required]

This PR refactors the recommendation engine by grouping the four individual scoring weight constants into a single SCORING_WEIGHTS dictionary. This makes the configuration cleaner and easier to manage. score_single_project() has been updated to use these dictionary values, and a test has been added to ensure the dictionary maintains the correct structure.

Related Issue [required]

Closes #6

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/recommender.py Removed standalone weight constants and replaced them with SCORING_WEIGHTS dictionary. Updated references in score_single_project().
tests/test_basic.py Added test_scoring_weights_has_all_keys to verify the new dictionary contains the required keys.

How to Test This PR [required]

  1. Clone this branch: git checkout fix/issue-6
  2. Install dependencies: pip install -r requirements.txt
  3. Run the app: python app.py
  4. Run the tests: python tests/test_basic.py

Expected test output:

28 passed, 0 failed out of 28 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
  PASS  test_view_code_found
  PASS  test_download_code_found
  PASS  test_scoring_weights_has_all_keys

28 passed, 0 failed out of 28 tests

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 28 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

Notes for Reviewer

Removed the unrelated badge/UI commits from the previous push this PR now contains only the scoring refactor and associated test.

@vercel

vercel Bot commented May 17, 2026

Copy link
Copy Markdown

@EHEGUY 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.

@EHEGUY

EHEGUY commented May 17, 2026

Copy link
Copy Markdown
Contributor Author

@komalharshita done !

@komalharshita komalharshita left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for the contribution — the scoring weights refactor itself is clean and the added regression test is a good addition.

However, this PR currently mixes two unrelated changes:

  1. Refactoring the recommendation scoring weights into SCORING_WEIGHTS
  2. Adding category badge UI changes to the project detail page

The linked issue (#6) only covers the scoring refactor. The badge system and related CSS/template updates belong to a separate feature and should be submitted in an independent PR.

Please remove the unrelated badge/UI commits from this PR (or open a separate PR for them) so the contribution stays properly scoped to the assigned issue.

Once the PR contains only the scoring refactor + associated tests, it will be much easier to review and merge.

@github-actions github-actions Bot added gssoc-2026 type:bug Something isn't working labels May 17, 2026
@EHEGUY

EHEGUY commented May 17, 2026

Copy link
Copy Markdown
Contributor Author

Hi @komalharshita Thank you for the detailed feedback really appreciate you taking the time to explain exactly what was wrong.

I've removed the unrelated badge/UI commits from this branch. The PR now contains only the SCORING_WEIGHTS refactor and the associated test, scoped strictly to issue #6.

All 28 tests pass locally. Ready for re-review whenever you get a chance!

@EHEGUY

EHEGUY commented May 17, 2026

Copy link
Copy Markdown
Contributor Author

@komalharshita the merge conflict has been solved can u review it !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:spam This will not be worked on gssoc-2026

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor the scoring weights into a configuration dictionary

2 participants