OperationCode/operationcode_backend

Filter expired scholarships from API response

jjhampton opened this issue · 2 comments

Feature

Why is this feature being added?

We're wanting to prevent display of expired scholarships on the Scholarships page.The API call to /api/v1/scholarships currently returns all scholarship objects, regardless of whether or not they are expired. To prevent the front-end from displaying the expired scholarships, this would currently require either:
a) Admins to manually remove expired scholarships from the DB, which is time-consuming, prone to human error/forgetfulness, and also would cause us to lose valuable data on scholarships
b) Filter out expired scholarships on the front-end and only show the ones that aren't expired

What should your feature do?

Each scholarship has a close_time property which represents the date when it's old/expired. We can use that date to filter out those expired scholarships from API response, either when fetching from the existing /api/v1/scholarships endpoint (maybe adding some query params to signal that we only want current ones?), or from a new endpoint (something like /api/v1/currentscholarships).
@hpjaj I defer to you on implementation details.

Here's three options

  1. Manually remove scholarships
  2. Filter out at the query level
  3. configure the whenever gem to daily remove expired scholarships with a rake task

If a PR contains either the 2nd or 3rd would we consider this a valid acceptance criteria?

Placeholder for @colto