项目作者: paulfioravanti

项目描述 :
Sentia's Rails application coding test.
高级语言: Ruby
项目地址: git://github.com/paulfioravanti/sentia-coding-test.git
创建时间: 2021-01-09T12:46:54Z
项目社区:https://github.com/paulfioravanti/sentia-coding-test

开源协议:MIT License

下载


Sentia Coding Test

An example Ruby on Rails application that can import information and display
it.

The application comes from a coding test, and I decided to take it on just
because I felt like I had not created a Rails application from scratch for a
while.

The application is currently deployed here using Heroku.

Blog Post

I wrote more about this codebase, and my rationale for all the major development
decisions, in the following blog post:

Language Versions

Setup

  1. git clone https://github.com/paulfioravanti/sentia-coding-test.git
  2. cd senta-coding-test
  3. bundle install
  4. bin/rails db:init
  5. yarn

Run

  1. bin/rails server

Open http://localhost:3000 in a browser and you should be greeted with
an empty table.

Sample Data

Import via User Interface

The original CSV file containing the data that the application must be able to
import can be found at:

  1. test/fixtures/files/SentiaCodingTestData.csv

This is the file that can be selected upon pressing the “Import Data” button
to import the required data.

Import via Fixtures

During development, I also recreated the seed data in Rails fixtures files,
which can be found under the test/fixtures directory. These can be loaded
into the database on the command line:

  1. bin/rails db:fixtures:load

Import via Rails Console

I often tested the logic in the file importer modules themselves via the Rails
console, so the data can also be imported in the following way:

  1. bin/rails console
  2. irb(main):001:0> file = File.open("#{Rails.root}/test/fixtures/files/SentiaCodingTestData.csv")
  3. irb(main):002:0> DataImporter.import(file)

Deploy

Push to Heroku with the following command:

  1. git push heroku main

Tests

No tests. Too lazy for this one.

Original Requirements

You will be required to create a Ruby on Rails application with the following
features below. The sample CSV data required for the test can be found
here. This application can be built in 1 hour.

Below is a list of user stories and requirements for each section of this
application.

PART 1

  1. As a user, I should be able to upload this sample CSV and import the data
    into a database.

    IMPORTER REQUIREMENTS

    a. The data needs to load into 3 tables. People, Locations and
    Affiliations

    b. A Person can belong to many Locations

    c. A Person can belong to many Affiliations

    d. A Person without an Affiliation should be skipped

    e. A Person should have both a first_name and last_name. All fields
    need to be validated except for last_name, weapon and vehicle which
    are optional.

    f. Names and Locations should all be titlecased

PART 2

  1. As a user, I should be able to view these results from the importer in a
    table.
  2. As a user, I should be able to paginate through the results so that I can see
    a maximum of 10 results at a time.
  3. As a user, I want to type in a search box so that I can filter the results I
    want to see.
  4. As a user, I want to be able to click on a table column heading to reorder
    the visible results.

Once the test has been completed. Please upload to Git Repo/Google Drive/DropBox
or zip and email over back to \ at \<person’s email>.