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:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user