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

Develop #7

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ gem 'pg'
gem 'icalendar'
gem 'thin'

gem 'dotenv-rails'
gem 'dotenv'

group :development do
gem 'shotgun'
gem "minitest"
gem 'minitest'
end
4 changes: 1 addition & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ GEM
dotenv (0.11.1)
dotenv-deployment (~> 0.0.2)
dotenv-deployment (0.0.2)
dotenv-rails (0.11.1)
dotenv (= 0.11.1)
eventmachine (1.0.3)
fastercsv (1.5.5)
icalendar (2.1.1)
Expand Down Expand Up @@ -104,7 +102,7 @@ PLATFORMS
DEPENDENCIES
datamapper
dm-postgres-adapter
dotenv-rails
dotenv
icalendar
json
minitest
Expand Down
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: bundle exec rackup config.ru -p $PORT
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ If you need postgres set up & are on a mac, I recommend checking out [this walkt

###To Run
```bash
shotgun # goofy name, just starts the server
shotgun # starts autoreloading development server
```

###To Test
Expand Down
2 changes: 0 additions & 2 deletions app/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
require "./app/models"

class Agora < Sinatra::Application
register Sinatra::ConfigFile
config_file("config.yml")

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty line detected at class body beginning.

# Set up DB
DataMapper.setup(:default, ENV["DATABASE_URL"] || "#{ENV["DB_ADAPTER"]}://#{ENV["DB_HOSTNAME"]}/#{ENV["DB_NAME"]}")
Expand Down
13 changes: 0 additions & 13 deletions app/config.yml

This file was deleted.

27 changes: 27 additions & 0 deletions app/models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,33 @@ class Event
# Location
property :location, String


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra blank line detected.

def self.ft_search(query_string, model_attributes)
# A crude, full text-ish search for events.
# Parameters:
# query_string = basic string, no operators are supported at this time.
# model_attributes = array of model attributes as symbols.

# split up search term into tokens
search_terms = query_string.split(' ').map{ |q| "%#{q}%" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space missing to the left of {.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

# using ILIKE for better querying.
operator = "ILIKE"

num_attr = model_attributes.count

# build out individual queries "<attribute> <operator> ? "
# so we can compose a larger query of something like:
# title ILIKE ? OR title ILIKE ?
query_chunks = model_attributes.map{|attr|
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using {...} for multi-line blocks.

Array.new(search_terms.count){ "#{attr.to_s} #{operator} ?" }.join(' OR ')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant use of Object#to_s in interpolation.
Space missing to the left of {.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

}
query = [query_chunks.flatten.join(' OR ')].concat( search_terms*num_attr)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surrounding space missing for operator '*'.
Space inside parentheses detected.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.


# execute query on events
Event.all( conditions: query )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space inside parentheses detected.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space inside parentheses detected.


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty line detected at body end.

end

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty line detected at body end.

end

class Source
Expand Down
4 changes: 4 additions & 0 deletions app/public/jquery-2.1.3.min.js

Large diffs are not rendered by default.

Loading