Intership @ Sympl Week 5
Ad Variants, Sorting Candidates & Demos
Mon 6 March:
Finishing up the ad variants page
Today I finished the last few details for the Instagram and Facebook ads (correct icons, getting the aspect ratio right, etc.).
Tue 7 - Fri 10 March:
Sorting Candidate Applications with scalability
After getting my pull request approved. I was assigned another task by my mentor: to sort through the applications of candidates who had applied for our clients vacancy. The objective was to efficiently manage the applications and streamline the hiring process. With a strong inclination towards learning and optimizing workflows, I decided to write code that would sort these applications by date. And to make sure the system would be adaptable to future requirements, I took scalability into account, giving myself the option to add more sorting methods as needed.
To tackle this challenge, I started by designing the data structure for candidate applications. I used an array of objects, where each object represented a single candidate's application with relevant information like their name, email, resume, and the date they applied.
Next, I implemented a sorting function to arrange the candidate applications by date. By default, the function sorted the applications in descending order, ensuring that the most recent applications appeared first. This allowed the hiring team to prioritize reviewing newer applications.
function sortByDate(applications: Application[]): Application[] {
return applications.sort((a, b) => {
const dateA = new Date(a.date);
const dateB = new Date(b.date);
return dateB.getTime() - dateA.getTime();
});
}
With the basic sorting function in place, I then focused on making the solution scalable. I wanted to provide the ability to add more sorting methods in the future, like sorting by candidate's name, skills, or other relevant criteria.
To achieve this, I created a higher-order function that would take a sorting method as an argument and return a new function that sorted the applications accordingly. This approach made it easy to add new sorting methods without modifying the existing codebase.
Here's a simplified version of the higher-order function:
type SortMethod = (a: Application, b: Application) => number;
function createSortFunction(
sortMethod: SortMethod
): (applications: Application[]) => Application[] {
return (applications: Application[]) => {
return applications.sort(sortMethod);
};
}
const sortByDateFunction = createSortFunction((a, b) => {
const dateA = new Date(a.date);
const dateB = new Date(b.date);
return dateB.getTime() - dateA.getTime();
});
This approach allowed me to easily add more sorting methods while maintaining a clean and modular codebase.
Application demos
During this week a few demos were given to the rest of the Sympl team. Mainly the AI enchancements were highlighted. Which were received with a lot of enthousiasm by the team.