Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shopify Engineering Project #297

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions DesignDocuments/Design_Document_Update-1.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
Project Name : ENGINEERING INTERN ASSESSMENT RAILS
Author : Kshithij Malebennur
Date : January 21st, 2024

1 INTRODUCTION

1.1 description

This document provides a full update on the most current updates and upgrades to the engineering
intern assessment for Shopify's backend engineering position. It strives to offer a clear and
simple explanation of the changes, improvements, and additions made since the prior iteration.
This update should keep all viewers, aware on the project's status and future direction.

1.2 scope

In this update, upgrades have been made to existing files. Along with this, new files
have been introduced.

MODIFICATIONS TO EXISTING FILES:

Gemfile: Updates were made to the 'Gemfile' file.

Gemfile.lock: With the update of Gemfile, there is an automatic update to Gemfile.lock.

Database Schema: The 'schema.rb' file has been updated automatically as it tries
to reflect the latest database schema (ex. new migrations).

test_helper: A new helper method has been added.

NEW ADDITIONS:

Model File (app/models/article.rb): A new model file was implemented in the directory mentioned.
This file defines the 'Article' model.

Migration Files: A migration directory and migration file has been added under the
db directory. These migrations allows for quick changes in the database
schema, concerning to the new 'Article' model.


2 PROBLEMS & SOLUTIONS

Problem 1: With the implementation of Article.rb, the file has to be tested
to determine if it's functional or has problems associated with it.
running any test command (ex. rails test) resulted in errors pertaining
to the gem net-protocol version 0.2.2. This prevented the model from being
tested.

Solution: To ensure this problem does not occur, the gem's 'net-http' and 'uri'
version 0.10.0 were added to the Gemfile. to solved the problem of
net-protocol preventing the test.

This solution was implemented with the use of "https://stackoverflow.com/questions/70443856/ruby-2-7-4-net-constant-warnings"

Problem 2: Though net-protocol no longer prevented the test from occurring,
another problem arose. Running the 'rails test' statement returned
"Migrations are pending. To resolve this issue, run: bin/rails db:migrate"
Running this made no difference as the problem still arose.
This problem also prevented the tests from running.

Solution: To fix this problem the commands "bundle exec rake prepare" and then
"bundle exec rake db:migrate" were ran in the command terminal. The problem
no longer occurred and the tests ran smoothly.

This solution was implemented with the use of "https://stackoverflow.com/questions/20082002/migrations-are-pending-run-bin-rake-dbmigrate-rails-env-development-to-resol?rq=1"


3 FEATURES & IMPLEMENTATION

3.1 Functionalities

'Article' Model: - Like the project goals requests, basic CRUD (CREATE, READ, UPDATE & DELETE)
actions were implemented in the model.
- Along with implementation of CRUD actions, a search feature was added using
Arel. Arel allows for a safer method of searching unlike "LIKE" or "ILIKE".
- This model also determines if an article is recent (published in the last seven days).
- The model orders the articles in descending order of the date.

4 NEXT STEPS

To progress this project, the next step would be to develop the controller associated
with the 'Article' model.
- The primary task is to implement all necessary functionalities in the controller.
- including defining actions for the CRUD operations.
- This will allow for interactions between the UI(user interface) and the database.
- the controller actions should be tested according to the test cases provided to determine
if the controller and model work together handle requests.


5 CONCLUSION

This document provides a detailed overview of the recent updates made to the Engineering Intern Assessment for Shopify's
Backend engineering position. Areas that were focused on during this update include:
- including new dependencies in the Gemfile
- Article model file has been added
- Resolving problems that arose
33 changes: 33 additions & 0 deletions DesignDocuments/Design_Document_Update-2.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Project Name : ENGINEERING INTERN ASSESSMENT RAILS
Author : Kshithij Malebennur
Date : January 23st, 2024

OVERVIEW

This document's purpose is to outline the implementation of new files that have
been added since the last update. Implementations such as the article controller
and routing changes to support article searches.

COMPONENTS

1. Routes Configuration
- Addition of a custom route that helps and supports searching of articles
within the collection of articles.

2. Article Controller
- This file has the definitions of the actions needed to perform CRUD operations
on article records


IMPLEMENTATION STEPS

1. Create the Article controller file which includes the necessary CRUD actions
2. Update the routes.rb file with a new search route
3. Implementation of the search action logic to handle search queries


FUTURE IMPLEMENTATIONS

1. Build the 'view' part of the MVC implementations wanted.
2. Test the search function, delete function and creation function.
3. Using CSS and Javascript, build the environment so that it is aesthetically
55 changes: 55 additions & 0 deletions DesignDocuments/Design_Document_Update-3.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
Project Name : ENGINEERING INTERN ASSESSMENT RAILS
Author : Kshithij Malebennur
Date : January 24st, 2024

OVERVIEW

This document's purpose is to outline the implementation of new files that have
been added since the last update. Implementations such as the view model that allows for a
responsive webpage for the articles.

COMPONENTS

1. Index Page
- This page is a landing page for the 'Articles' section of the application. It provides
an accessible overview of any and all articles stored in the database.
- This page includes a search action that allows for users to filter out articles using
any key words in the title or content.
- Each article displays the title, which is a link to the actual content of the page. along
with the date of publication.
- Each article has their own 'Edit' and 'Delete' buttons. the Edit button allows for users to
edit the title, date or content of the article.

2. Edit Page
- This page is a simple implementation of a webpage that allows users to edit the contents of the
article.

3. Show Page
- This page displays the full details of an individual article. When the title link is clicked on the index
page, this is the page that opens.
- The page allows for users to view the date of the publication along with the title and the content. Another
section called Recent, allows the users to know if the article is recently posted. This is true if the article
is posted 7 days prior or earlier.

4. New Page
- This page allows for users to input their own article.
- This page has sections that allows the user to input their title for the article, the content they want to present
when the article is clicked on, and the date of the publication. If no date is provided, the webpage will take the
present date.

5. application.css
- This css file, as of right now, holds basic styling for the webpage.

IMPLEMENTATION STEPS

1. Build the different html.erb files. This includes _form.html.erb, edit.html.erb, index.html.erb, new.html.erb, and
show.html.erb.
2. Implemented the CSS file that gives a basic style to all the parts of the different HTML stated above.
3. Changes made to the search function in the article model which allows the search form to order the search results from,
closes to the query, to farthest from the query.

FUTURE IMPLEMENTATIONS

1. Make the CSS styling more appealing and aesthetically pleasing.
2. Make sure there are no loop holes or fault in the code.
3. Debug everything and make sure the final product is one worthy of the project.
36 changes: 36 additions & 0 deletions DesignDocuments/Design_Document_Update-4.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Project Name : ENGINEERING INTERN ASSESSMENT RAILS
Author : Kshithij Malebennur
Date : January 28st, 2024

OVERVIEW

This document outlines the implementation of new files and features added
since the last update. This recent update focuses on the enhanced view model
for a responsive webpage in the article section, improving user experience
and interaction.

COMPONENTS

1. Aesthetic Redesign
- The objective was to enhance the visual appeal of the webpage for the
betterment of the user experience.
- The redesign is done using the application.css file.
- The layout is more aesthetically pleasing than before and it is easier to
interact with.
- The color scheme is also more visually pleasing

2. Search Functionality Enhancement
- The objective was to improve the accuracy and efficiency of the search function.

3. _form.html.erb (new page, edit page)
- This page controls the interactive parts of the new page and the edit page. In this
update, this page allows for the user to upload an image that will directly connect
to the article.
- Additional javascript code is added into this page so that if the user wants to break
the line in their text by hitting enter, the article will not submit itself. By hitting
enter without the shift key, the cursor will go to the next line. With the shift key, the
article will submit.

FUTURE IMPLEMENTATION STEPS

1. Look for any bugs and and make sure the tests work before submission.
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ gem "stimulus-rails"
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"


# Addition of 'net-http' and 'uri' version 0.10.0 as problems occur with
# net-protocol version 0.2.2 when testing the code
gem 'net-http'
gem 'uri', '0.10.0'

# Use Redis adapter to run Action Cable in production
# gem "redis", ">= 4.0.1"

Expand Down
11 changes: 11 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ GEM
minitest (5.20.0)
msgpack (1.7.2)
mutex_m (0.2.0)
net-http (0.4.1)
uri
net-imap (0.4.8)
date
net-protocol
Expand All @@ -147,6 +149,8 @@ GEM
racc (~> 1.4)
nokogiri (1.15.5-aarch64-linux)
racc (~> 1.4)
nokogiri (1.15.5-x64-mingw32)
racc (~> 1.4)
nokogiri (1.15.5-x86_64-linux)
racc (~> 1.4)
psych (5.1.1.1)
Expand Down Expand Up @@ -215,6 +219,7 @@ GEM
sqlite3 (1.6.9)
mini_portile2 (~> 2.8.0)
sqlite3 (1.6.9-aarch64-linux)
sqlite3 (1.6.9-x64-mingw32)
sqlite3 (1.6.9-x86_64-linux)
stimulus-rails (1.3.0)
railties (>= 6.0.0)
Expand All @@ -227,6 +232,9 @@ GEM
railties (>= 6.0.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
tzinfo-data (1.2023.4)
tzinfo (>= 1.0.0)
uri (0.10.0)
web-console (4.2.1)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
Expand All @@ -248,6 +256,7 @@ GEM
PLATFORMS
aarch64-linux
ruby
x64-mingw32
x86_64-linux

DEPENDENCIES
Expand All @@ -256,6 +265,7 @@ DEPENDENCIES
debug
importmap-rails
jbuilder
net-http
puma (>= 5.0)
rails (~> 7.1.2)
selenium-webdriver
Expand All @@ -264,6 +274,7 @@ DEPENDENCIES
stimulus-rails
turbo-rails
tzinfo-data
uri (= 0.10.0)
web-console
webdrivers

Expand Down
Loading