Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Khalid Ali
schedules
Commits
56a9d97c
Commit
56a9d97c
authored
May 09, 2018
by
Zac Wood
Browse files
Rubocop compliance
parent
52c31168
Changes
1
Hide whitespace changes
Inline
Side-by-side
schedules/db/seeds.rb
View file @
56a9d97c
...
...
@@ -32,7 +32,7 @@ semester.save!
total
.
each
do
|
subject
|
subject
.
each_value
do
|
section
|
next
unless
(
section
.
has_
key?
"date_range"
)
&&
(
section
.
has_
key?
"instructors"
)
next
unless
(
section
.
key?
"date_range"
)
&&
(
section
.
key?
"instructors"
)
course
=
Course
.
find_or_create_by
(
subject:
section
[
:subj
],
course_number:
section
[
:code
])
...
...
@@ -43,19 +43,18 @@ total.each do |subject|
section_name
=
"
#{
section
[
:subj
]
}
#{
section
[
:code
]
}
#{
section
[
:sect
]
}
#{
section
[
:name
]
}
"
puts
"Adding
#{
section_name
}
..."
start_time
=
if
section
.
has_
key?
"time"
start_time
=
if
section
.
key?
"time"
section
[
"time"
].
split
(
' - '
).
first
else
"N/A"
end
end_time
=
if
section
.
has_
key?
"time"
end_time
=
if
section
.
key?
"time"
section
[
"time"
].
split
(
' - '
).
last
else
"N/A"
end
Section
.
create!
(
name:
section_name
,
crn:
section
[
:crn
],
title:
section
[
:name
],
...
...
@@ -66,6 +65,5 @@ total.each do |subject|
end_time:
end_time
,
instructor:
section
[
"instructors"
].
split
(
' '
).
map
{
|
word
|
word
unless
word
.
empty?
}.
join
(
' '
),
course:
course
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment