Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
schedules
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
11
Issues
11
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SRCT
schedules
Commits
45df0731
Commit
45df0731
authored
Oct 28, 2018
by
Zac Wood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
the tests might actually pass now
parent
f444af2e
Pipeline
#3299
passed with stage
in 2 minutes and 9 seconds
Changes
13
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
18 additions
and
21 deletions
+18
-21
schedules/.rubocop.yml
schedules/.rubocop.yml
+3
-0
schedules/app/controllers/api/courses_controller.rb
schedules/app/controllers/api/courses_controller.rb
+1
-1
schedules/app/controllers/application_controller.rb
schedules/app/controllers/application_controller.rb
+1
-1
schedules/app/controllers/courses_controller.rb
schedules/app/controllers/courses_controller.rb
+2
-3
schedules/app/controllers/schedules_controller.rb
schedules/app/controllers/schedules_controller.rb
+0
-1
schedules/app/controllers/sessions_controller.rb
schedules/app/controllers/sessions_controller.rb
+1
-3
schedules/app/helpers/search_helper.rb
schedules/app/helpers/search_helper.rb
+1
-1
schedules/app/models/course.rb
schedules/app/models/course.rb
+1
-1
schedules/app/models/semester.rb
schedules/app/models/semester.rb
+1
-1
schedules/config/initializers/assets.rb
schedules/config/initializers/assets.rb
+3
-3
schedules/config/routes.rb
schedules/config/routes.rb
+1
-1
schedules/test/controllers/api/courses_controller_test.rb
schedules/test/controllers/api/courses_controller_test.rb
+0
-2
schedules/test/controllers/api/schedules_controller_test.rb
schedules/test/controllers/api/schedules_controller_test.rb
+3
-3
No files found.
schedules/.rubocop.yml
View file @
45df0731
...
...
@@ -13,3 +13,6 @@ Style/SymbolArray:
Metrics/BlockLength
:
Enabled
:
false
Style/ClassAndModuleChildren
:
Enabled
:
false
schedules/app/controllers/api/courses_controller.rb
View file @
45df0731
...
...
@@ -7,7 +7,7 @@ class API::CoursesController < ApplicationController
api
:GET
,
'/courses'
,
"Get a list of courses."
param
:subject
,
String
,
desc:
'Course subject, e.g. "CS" or "ACCT"'
param
:course_number
,
Integer
,
desc:
'Course number, e.g. "112"'
def
index
def
index
@courses
=
Course
.
fetch
(
params
).
all
render
json:
@courses
end
...
...
schedules/app/controllers/application_controller.rb
View file @
45df0731
...
...
@@ -7,7 +7,7 @@ class ApplicationController < ActionController::Base
@semester
=
if
cookies
.
key?
(
:semester_id
)
Semester
.
find_by
(
id:
cookies
[
:semester_id
])
else
sem
=
Semester
.
fi
nd_by
(
season:
'Spring'
,
year:
'2019'
)
sem
=
Semester
.
fi
rst
cookies
[
:semester_id
]
=
sem
.
id
sem
end
...
...
schedules/app/controllers/courses_controller.rb
View file @
45df0731
class
CoursesController
<
ApplicationController
before_action
:set_course
def
show
end
def
show
;
end
private
...
...
schedules/app/controllers/schedules_controller.rb
View file @
45df0731
...
...
@@ -21,5 +21,4 @@ class SchedulesController < ApplicationController
# this works(?)
# recursively build a list of sets containing 1 section from each course chosen
end
schedules/app/controllers/sessions_controller.rb
View file @
45df0731
...
...
@@ -9,7 +9,7 @@ class SessionsController < ApplicationController
def
cart
section_id
=
params
[
:section_id
]
if
@cart
.
include?
(
section_id
)
@cart
.
reject!
{
|
id
|
section_id
==
id
}
else
...
...
@@ -20,8 +20,6 @@ class SessionsController < ApplicationController
cookies
[
:cart
]
=
@cart
.
to_json
render
json:
@cart
.
to_json
end
private
...
...
schedules/app/helpers/search_helper.rb
View file @
45df0731
...
...
@@ -2,7 +2,7 @@ module SearchHelper
def
in_cart?
(
id
)
@cart
.
include?
id
.
to_s
end
class
GenericQueryData
attr_reader
:semester
attr_reader
:sort_mode
...
...
schedules/app/models/course.rb
View file @
45df0731
...
...
@@ -15,7 +15,7 @@ class Course < ApplicationRecord
def
full_name
"
#{
subject
}
#{
course_number
}
"
end
def
self
.
from_subject
(
base_query
,
subject
)
base_query
.
where
(
"courses.subject = ?"
,
subject
.
upcase
)
end
...
...
schedules/app/models/semester.rb
View file @
45df0731
...
...
@@ -10,6 +10,6 @@ class Semester < ApplicationRecord
validates
:season
,
presence:
true
def
to_s
return
"
#{
season
}
#{
year
}
"
"
#{
season
}
#{
year
}
"
end
end
schedules/config/initializers/assets.rb
View file @
45df0731
...
...
@@ -14,13 +14,13 @@ Rails.application.config.assets.paths << Rails.root.join('node_modules')
Rails
.
application
.
config
.
assets
.
precompile
+=
%w(
search.js
search.scss
schedules.js
schedules.scss
cart.js
cart.scss
FileSaver.js
masonstrap.min.css
masonstrap.min.js
...
...
schedules/config/routes.rb
View file @
45df0731
...
...
@@ -7,7 +7,7 @@ Rails.application.routes.draw do
resources
:courses
,
only:
[
:show
]
resources
:instructors
,
only:
[
:index
,
:show
]
get
'schedule'
,
to:
'schedules#show'
,
as:
'schedule'
scope
:api
,
module:
'api'
do
# Register /api routes
resources
:courses
,
only:
[
:index
,
:show
],
as:
'api_courses'
resources
:course_sections
,
only:
[
:index
],
as:
'api_course_sections'
...
...
schedules/test/controllers/api/courses_controller_test.rb
View file @
45df0731
require
'test_helper'
class
API::CoursesControllerTest
<
ActionDispatch
::
IntegrationTest
semester_id
=
semesters
(
:fall2018
).
id
test
'#index should return all courses'
do
get
api_courses_url
assert_response
:success
...
...
schedules/test/controllers/api/schedules_controller_test.rb
View file @
45df0731
...
...
@@ -2,13 +2,13 @@ require 'test_helper'
class
API::SchedulesControllerTest
<
ActionDispatch
::
IntegrationTest
test
"should generate schedule"
do
crns
=
[
course_sections
(
:cs112001
).
crn
,
course_sections
(
:cs112002
).
crn
]
get
"/api/schedules?
crns=
#{
crn
s
.
join
(
','
)
}
"
ids
=
[
course_sections
(
:cs112001
).
id
,
course_sections
(
:cs112002
).
id
]
get
"/api/schedules?
section_ids=
#{
id
s
.
join
(
','
)
}
"
# DTSTAMP and UID lines uniquely identify events, so we can't test against them.
# so remove all the lines starting with them.
# the \r characters are also annoying so just remove them too
gen
=
@response
.
body
.
split
(
"
\n
"
).
select
{
|
line
|
!
line
.
include?
(
"DTSTAMP"
)
&&
!
line
.
include?
(
"UID"
)
}.
join
(
"
\n
"
).
delete
(
"
\r
"
)
gen
=
@response
.
body
.
split
(
"
\n
"
).
reject
{
|
line
|
line
.
include?
(
"DTSTAMP"
)
||
line
.
include?
(
"UID"
)
}.
join
(
"
\n
"
).
delete
(
"
\r
"
)
correct_ical
=
File
.
open
(
"test/test.ics"
).
read
.
delete
(
"
\r
"
)
assert_equal
correct_ical
,
gen
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