Refactor shortlisted candidates access and fix index check

<UserStory> EMP0012 : Employee Management </UserStory>

<Changes>
 - Changed getShorlistedCandidates() to return by value instead of reference
 - Updated controller and service method signatures accordingly
 - Fixed off-by-one error when selecting shortlisted candidate
</Changes>

<Review>
Smitha Mohan
</Review>
This commit is contained in:
2026-04-16 10:05:19 +05:30
parent f15d5b7f1d
commit 7351186baf
5 changed files with 5 additions and 5 deletions
@@ -166,7 +166,7 @@ void addShortlistedCandidateAsEmployee(const std::shared_ptr<ZenvyController>& c
auto currentEmployee = controller->getCurrentEmployee();
Enums::EmployeeType employeeType;
Enums::EmployeeDesignation employeeDesignation = Enums::EmployeeDesignation::INVALID;
if (index > 0 && index < shortlistedCandidates.size())
if (index > 0 && index <= shortlistedCandidates.size())
{
employeeType = getEmployeeType(currentEmployee->getEmployeeType());
std::shared_ptr<Candidate> candidate = shortlistedCandidates[index - 1];