isthisjoe / newco-coding-challenge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Newco Coding Challenge

Getting started

This project uses ruby 3.0.1 and is configued to use rvm, but feel free to use whichever version manager you prefer. It also utilizes a Postgres database.

git clone https://github.com/IAC-Newco/newco-coding-challenge && cd newco-coding-challenge
bundle
rake db:create && rake db:migrate
rspec

Challenge

This is a challenge to see how you solve a problem that's similar to the work we do here at Newco. This assumes you know basic Rails principles and it's really for us to see your thought process plus there's some creative thinking involved.

It should take no more than 1-2 hours but please don't feel like you need to be super thorough with everything, we'll only review whatever you provide.

The application is a simple social network where a user can follow/have followers, create posts that have some content, and those posts can be "liked" or "saved" by other users.

The task is to implement 3 different feed API methods, which can be found at app/controllers/api/v1/feed_controller.rb:

1. for_user

Implement a feed based on view status of a post and following status of the poster.

Sort -> First, we want to prioritize posts that have not been viewed by current_user. Then, we want to divide these unviewed posts into buckets based on the day of creation. Within each day we want to show posts from users that the current_user follows first then other posts. After serving all unviewed posts as described above, we can just served already viewed content based on post creation timestamp

Example - current_user follows User A and User B but not User C and User D. in general the sort order would be the following:

  1. all unviewed posts created by User A and User B on 4/6
  2. all unviewed posts created by User C and User D on 4/6
  3. all unviewed posts created by User A and User B on 4/5
  4. all unviewed posts created by User C and User D on 4/5 (...continuing until all unviewed posts have been shown))
  5. then all previously viewed posts from Users A/B/C/D, sorted reverse chronologically

2. top

Implement a feed based on overall popularity on the platform.

Sort -> We want to rank all posts based on a score generated by the following equation:

post_score = 3 * likes_count and 1 * views_count

E.g. A post has 10 likes and 24 views. (3 * 10) + (1 * 24) = 54 is this post's score.

However we also only want to show posts that have not been viewed by the current_user.

3. custom

Construct a custom feed based on any logic that you think describes a well implemented feed.

The goal here is to provide a user a single feed of posts that is as tailored as possible to the user and also to surface other popular content that they may have missed

Once your changes are complete, please push the changes to a repo associated with your own GitHub account and share with the following GitHub user: isthisjoe.

One final note: it's OK if you can't complete the entire challenge as outlined above; we're more interested in learning about how you approached solving the problems. We'll review your implementation together when we meet in person.

About


Languages

Language:Ruby 86.7%Language:HTML 7.7%Language:JavaScript 4.7%Language:CSS 1.0%