Skip to content

Commit

Permalink
Merge 36e60d3 into 7162314
Browse files Browse the repository at this point in the history
  • Loading branch information
bwootten committed Jul 20, 2015
2 parents 7162314 + 36e60d3 commit 7537455
Show file tree
Hide file tree
Showing 15 changed files with 106 additions and 15 deletions.
17 changes: 9 additions & 8 deletions app/models/section.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,17 @@ def stories_to_hash(cluster)
# sort story_cluster so preferred stories are first
{ 'preferred' => story_cluster[0], 'other_sources' => story_cluster[1..-1], 'size' => story_importance(story_cluster) }
end
cluster.each do |story|
if story['preferred'].has_image?
story['size'] = 'splash'
break
end
end
cluster
# Split stories into groups with images and without images
# build an array of size groups out of those
# shuffle then flatten?

# So we kind of have a chicken//egg scenario here. Being able to grab images informs the size of stories
# but at the same time grabbing images takes really long so being able to figure out the sizes of stories
# first would speed that up

end

def story_importance(story_cluster)
def random_story_importance(story_cluster)
if story_cluster[0].has_image?
%w(big medium splash small).sample
else
Expand Down
9 changes: 9 additions & 0 deletions db/migrate/20150720182330_create_users.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :email
t.text :password_digest
t.timestamps
end
end
end
9 changes: 9 additions & 0 deletions db/migrate/20150720182341_create_sections.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CreateSections < ActiveRecord::Migration
def change
create_table :sections do |t|
t.string :title
t.references :user
t.timestamps
end
end
end
13 changes: 13 additions & 0 deletions db/migrate/20150720182440_create_articles.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class CreateArticles < ActiveRecord::Migration
def change
create_table :articles do |t|
t.string :title
t.text :summary
t.string :url
t.string :last_modified
t.references :subscription
t.string :img_link
t.timestamps
end
end
end
8 changes: 8 additions & 0 deletions db/migrate/20150720182518_create_feeds.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class CreateFeeds < ActiveRecord::Migration
def change
create_table :feeds do |t|
t.string :feed_url
t.timestamps
end
end
end
9 changes: 9 additions & 0 deletions db/migrate/20150720182532_create_articles_stories.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CreateArticlesStories < ActiveRecord::Migration
def change
create_table :articles_stories do |t|
t.references :article
t.references :story
t.timestamps
end
end
end
10 changes: 10 additions & 0 deletions db/migrate/20150720182539_create_stories.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateStories < ActiveRecord::Migration
def change
create_table :stories do |t|
t.string :size
t.references :user
t.references :preferred_story
t.timestamps
end
end
end
11 changes: 11 additions & 0 deletions db/migrate/20150720182645_create_subscriptions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class CreateSubscriptions < ActiveRecord::Migration
def change
create_table :subscriptions do |t|
t.references :feed
t.references :Section
t.string :url
t.string :name
t.timestamps
end
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CreateArticles < ActiveRecord::Migration
class CreateArticles < ActiveRecord::Migration
def change
create_table :articles do |t|
t.string :title
Expand Down
File renamed without changes.
33 changes: 27 additions & 6 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20150718182019) do
ActiveRecord::Schema.define(version: 20150720182645) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand All @@ -22,9 +22,22 @@
t.string "url"
t.string "last_modified"
t.integer "subscription_id"
t.string "img_link"
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "articles_stories", force: :cascade do |t|
t.integer "article_id"
t.integer "story_id"
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "feeds", force: :cascade do |t|
t.string "feed_url"
t.datetime "created_at"
t.datetime "updated_at"
t.string "img_link"
end

create_table "sections", force: :cascade do |t|
Expand All @@ -34,18 +47,26 @@
t.datetime "updated_at"
end

create_table "stories", force: :cascade do |t|
t.string "size"
t.integer "user_id"
t.integer "preferred_story_id"
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "subscriptions", force: :cascade do |t|
t.string "feed_url"
t.integer "feed_id"
t.integer "Section_id"
t.string "url"
t.integer "section_id"
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
t.string "name"
end

create_table "users", force: :cascade do |t|
t.string "email"
t.string "password_digest"
t.text "password_digest"
t.datetime "created_at"
t.datetime "updated_at"
end
Expand Down

0 comments on commit 7537455

Please sign in to comment.