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
SRCT
schedules
Commits
a786e4ad
Commit
a786e4ad
authored
May 12, 2019
by
Zac Wood
Browse files
More calendar tweaks
parent
31d0222f
Changes
6
Hide whitespace changes
Inline
Side-by-side
schedules/app/controllers/courses_controller.rb
View file @
a786e4ad
...
...
@@ -2,6 +2,7 @@ class CoursesController < ApplicationController
def
show
# Load the course with the id passed in the URL.
@course
=
Course
.
find_by_id
(
params
[
:id
])
@rating
=
@course
.
rating
@sections
=
@course
.
course_sections
.
where
(
semester:
@semester
)
end
end
schedules/app/javascript/src/Calendar.jsx
View file @
a786e4ad
...
...
@@ -7,6 +7,12 @@ import withSizes from 'react-sizes';
const
localizer
=
BigCalendar
.
momentLocalizer
(
moment
);
const
minTime
=
new
Date
();
minTime
.
setHours
(
7
,
0
,
0
);
const
maxTime
=
new
Date
();
maxTime
.
setHours
(
23
,
0
,
0
);
const
Calendar
=
props
=>
(
<
div
className
=
"full-width"
style
=
{
{
backgroundColor
:
'
white
'
,
padding
:
'
24px
'
}
}
>
<
BigCalendar
...
...
@@ -25,6 +31,7 @@ const Calendar = props => (
dayRangeHeaderFormat
:
()
=>
''
,
}
}
style
=
{
{
height
:
'
75vh
'
}
}
min
=
{
minTime
}
/>
</
div
>
);
...
...
schedules/app/models/course.rb
View file @
a786e4ad
...
...
@@ -9,4 +9,16 @@ class Course < ApplicationRecord
def
full_name
"
#{
subject
}
#{
course_number
}
"
end
def
rating
(
question
=
1
,
sections
=
self
.
course_sections
)
total
=
0
resp
=
0
sections
.
each
do
|
s
|
next
if
s
.
rating_questions
.
empty?
resp
+=
s
.
rating_questions
[
question
][
"resp"
].
to_i
total
+=
s
.
rating_questions
[
question
][
"instr_mean"
].
to_f
*
s
.
rating_questions
[
0
][
"resp"
].
to_i
end
[(
total
/
resp
).
round
(
2
),
resp
]
unless
resp
.
zero?
end
end
schedules/app/views/courses/show.html.erb
View file @
a786e4ad
...
...
@@ -2,8 +2,12 @@
<div
class=
"col-12 col-lg"
>
<h1>
<%=
@course
.
full_name
%>
</h1>
<h4>
<%=
@course
.
title
%>
</h4>
<%
unless
@rating
.
nil?
%>
<%=
render
partial:
'shared/stars'
,
locals:
{
percent:
@course
.
rating
[
0
]
/
5
*
100
}
%>
Average course rating:
<%=
@course
.
rating
[
0
]
%>
/
<%=
@course
.
rating
[
1
]
%>
responses
<%
end
%>
<div
class=
"d-flex"
>
<div
class=
"d-flex
mt-2
"
>
<div
class=
"attr-list justify-content-start"
>
<div
class=
"attr"
>
<div
class=
"icon"
>
...
...
@@ -20,7 +24,7 @@
</div>
</div>
</div>
<p>
<%=
@course
.
description
%>
</p>
<p
class=
"mt-3"
>
<%=
@course
.
description
%>
</p>
</div>
<div
class=
"col-12 col-lg"
>
...
...
schedules/app/views/home/index.html.erb
View file @
a786e4ad
...
...
@@ -8,7 +8,7 @@
</p>
</div>
<div
class=
"row"
>
<div
class=
"row
"
>
<div
class=
"col-md-4"
>
<div
class=
"card"
>
<div
class=
"card-body"
>
...
...
schedules/app/views/instructors/show.html.erb
View file @
a786e4ad
<div
class=
"row"
>
<div
class=
"col-lg-4 col-12 mb-4"
>
<h1>
<%=
@instructor
.
name
%>
</h1>
<%
unless
@rating
[
:teaching
].
nil?
%>
<%=
render
partial:
'shared/stars'
,
locals:
{
percent:
@rating
[
:teaching
][
0
]
/
5
*
100
}
%>
<br>
Average teaching rating:
<%=
@rating
[
:teaching
][
0
]
%>
/
<%=
@rating
[
:teaching
][
1
]
%>
responses
<%
end
%>
</div>
...
...
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