GithubHelp home page GithubHelp logo

angadi's Introduction

Angadi Travis Build

Angadi (Tamil: அங்காடி. Meaning: Market, Shop) is a Ruby on Rails webapp to demo a custom built eCommerce site.

Deploy to Heroku

This application was generated with the rails_apps_composer gem provided by the RailsApps Project.

Running on Local machine

  • Verify and fix local database username and password here: config/database.yml
  • Run the following command on terminal from the project folder
$ bundle install
$ RAILS_ENV=development rake db:create db:setup
$ rails server

Features

Website

The website UI is built using bootstrap 3.

Admin page

Admin page provides interface to edit products, categories, brands and campaigns. https://angadi-balaji.herokuapp.com/admin

Notable implementations

  • Category -> Sub-Category -> Sub-Sub-category is implemented via a tree-like structure with each record in categories table having a parent_id that is an id of the categories record itself. Querying all products belong to a particular node in the tree is implemented via psql recursive query.
def all_children
    Category.find_by_sql(%(WITH RECURSIVE all_categories AS (
           SELECT  id, name, parent_id FROM categories
             WHERE id = '#{id}'
           UNION
           SELECT cat.id, cat.name, cat.parent_id FROM categories cat
             JOIN all_categories a
               ON (a.id = cat.parent_id)
          )
          SELECT * FROM all_categories;))
  end
  • Full text search is done via Postgresql's tsvector and tsquery datatypes.
def search_query(term)
      ActiveRecord::Base.connection.execute(%(select id
        from (select products.id as id,
              to_tsvector(categories.name) ||
              to_tsvector(products.name) ||
              to_tsvector(brands.name) as document
                from products
                join categories on categories.id = products.category_id
                join brands on brands.id = products.brand_id) search
              where search.document @@ to_tsquery('#{term}')
              order by ts_rank(search.document, to_tsquery('#{term}')) desc;))
    end

TODO Features and enhancements

  • Create products, categories, brands, campaigns via Admin interface
  • Rating and Reviews
  • Discounts
  • Multiple images for products
  • Campaign pages
  • Chain multiple searches together
  • Custom UI (enhance the default bootstrap UI)
  • Improve test coverage

angadi's People

Contributors

balaji avatar

Watchers

James Cloos 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.