Code Monkey home page Code Monkey logo

ocena's People

Contributors

bethel-m avatar dependabot[bot] avatar deven96 avatar iamdavidonuh avatar mensaah avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

iamdavidonuh

ocena's Issues

Retrieve from gophie core

Enable search and listing API endpoints (issue #2) to first try retrieve information from gophie core, if that fails then retrieve from database

New User System

A new way to identify users that replaces ip_addresses in the codebase

Listing endpoint improvement

We can make sure the listing returns endpoints by most recent according to how it was posted on the app
We add a saved_on column to Movie. Then since ocena is the one calling gophie, we can take the page number(when it is list)
We can now use it to set a datetime object on the returned object, e.g if the page number is 1, we set saved_on to be a day behind... if it is page 2, we set saved_on to be 2 days behind. This way, when we order by saved on, recent movies will tend to cluster at the top and our listing wouldn't look like random selections...

Refactor

@router.post("/movie/ratings/average/", response_model=schemas.AverageRating)
def get_average_ratings(movie: schemas.MovieRating, db: Session = Depends(get_db)):
    """
    Get average movie ratings and number of people who have rated
    """
    return crud.get_movie_average_ratings(db=db, movie=movie)


@router.post("/movie/rating/", response_model=schemas.Rating)
def get_ip_rating(spec_rating: schemas.SpecificRating, db: Session = Depends(get_db)):
    """
    Get Rating of a movie by an ip_address
    """
    return crud.get_rating(db=db, spec_rating=spec_rating)


@router.post("/movie/downloads/", response_model=int)
def get_downloads(movie: schemas.MovieRating, db: Session = Depends(get_db)):
    """
    Gets number of downloads of a movie
    """
    return crud.get_number_of_downloads(db=db, movie=movie)


@router.post("/movie/referrals/", response_model=int)
def get_referrals(movie: schemas.MovieRating, db: Session = Depends(get_db)):
    """
    Gets total number of referrals of a movie
    """
    return crud.get_no_of_referrals(db=db, movie=movie)

All needs to be done when fetching movie data without makeing further requests

Clear cache if gophie response is not 200

If gophie response is not 200 (like gophie is temporarily down) , we would need to clear cache else all the calls will be made to ocena for the next 24 hours even when gophie comes up

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.