From 8276e375a764e85619b60d5b3c8cc3b058888fb5 Mon Sep 17 00:00:00 2001 From: Triv24 Date: Mon, 18 May 2026 22:59:50 +0530 Subject: [PATCH] fix: Resolved the time availability bug to return only the projects having same or lower time availability as set by user. --- utils/recommender.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/utils/recommender.py b/utils/recommender.py index 308c14f..c5a4f21 100644 --- a/utils/recommender.py +++ b/utils/recommender.py @@ -67,6 +67,11 @@ def score_single_project( Returns an integer score (0 means no match at all). """ + # Compare time availability, return results with the same time availibity or lower. + TIME_AVAILABILITY = ['low', 'medium', 'high'] + time_availability_index = TIME_AVAILABILITY.index(time_availability.strip().lower()) + valid_time = TIME_AVAILABILITY[ : time_availability_index + 1 ] + score = 0 # Compare user's skills against the project's required skills @@ -88,7 +93,9 @@ def score_single_project( if project.get("time", "").lower() == time_availability.lower(): score += SCORING_WEIGHTS["time"] - return score + if project.get("time", "").lower() in valid_time : + return score + return 0 def get_recommendations(skills_string, level, interest, time_availability):