gdscashesi / ashesi-hackers-league

competitive series of coding challenges across data structures and algorithms, scripting ( python & bash ) and SQL.
https://ashesi-hackers-league.web.app/
6 stars 1 forks source link

getCurrentSeason #58

Closed faddalibrahim closed 2 years ago

faddalibrahim commented 2 years ago

There should be a way to know the current season (fall2022, spring2022 etc) whose data is supposed to be fetched

We could do that by creating a field in our database to store the current season. But it means we will have to be changing that manually at the start of every season. And also, when fetching data, we will make double calls to the database: 1, for getting the current season, 2 for fetching the data for that season

how about we create a function to determine the current season on the frontend, which we will use to determine which data to fetch from the database right away.

what do we know?

There are 2 seasons in a year: Spring (January to May) and Fall ( September to December )

We can use the Date object in javascript to do that, right? You got this!

Simon-157 commented 2 years ago

should something be returned if the current month is neither within the fall or the spring period?

faddalibrahim commented 2 years ago

should something be returned if the current month is neither within the fall or the spring period?

yeah, great question. you know what? extend the period. Spring : January to August Fall: September to December

so that during the summer vacation , it shows results for the spring

Simon-157 commented 2 years ago

should something be returned if the current month is neither within the fall or the spring period?

yeah, great question. you know what? extend the period. Spring : January to August Fall: September to December

so that during the summer vacation , it shows results for the spring

Alright then