Code Monkey home page Code Monkey logo

newco-coding-challenge's Introduction

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.

newco-coding-challenge's People

Contributors

adebaere avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.