Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class User < ApplicationRecord
has_many :event_instances
has_many :commit_counts
has_many :status
has_many :courses

has_many :subscriptions, autosave: true

Expand Down
25 changes: 24 additions & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

klasses = [Project, Document, User, Subscription, Karma, Plan, Article, Event, EventInstance, Karma]
klasses = [Project, Document, User, Subscription, Karma, Plan, Article, Event, EventInstance, Karma, Course]
old_counts = klasses.map(&:count)
should_prompt = old_counts.min.positive?

Expand Down Expand Up @@ -77,6 +77,20 @@ def get_country
)

puts 'Created default projects'

opensource = u.courses.create!(

Choose a reason for hiding this comment

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

I see we have an object called opensource but I can't seem to find where this is referenced

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

title: 'OpenSource',
description: 'How to contribute to open source projects.',
status: 'Active'
)

gitcourse = u.courses.create!(

Choose a reason for hiding this comment

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

same as above. If we are not using those variables: gitcourse and opensource, we should consider removing them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

title: 'GitCourse',
description: 'Learn how to use git and github.',
status: 'Active'
)

puts 'Created default courses'
break
elsif %w(n no).include?(response)
break
Expand Down Expand Up @@ -108,6 +122,15 @@ def get_country
)
end
end

3.times do
p = u.courses.create(
title: Faker::Educator.course_name,
description: Faker::TvShows::GameOfThrones.quote,
status: 'active',
created_at: 1.month.ago
)
end
end

# Premium Users
Expand Down