-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Team Turing Whiteboard final version #241
base: master
Are you sure you want to change the base?
Changes from 11 commits
f302e33
a0b98c8
91f7162
8f714c6
d3d44ce
d2d3fae
6311da3
460ea92
ba27ee5
3bc5b82
6f8c430
076c205
a55beaf
d62ea71
5e0e8a7
7fa5a9d
5501632
42769ad
193536d
f065d8e
d4b24a2
2d03c9e
4ee3929
94c2531
1251471
985c909
087085d
04217b5
7321fde
6bc2d43
481678d
969a4c5
201fed2
d8a8a7a
1a5c1ec
34826a0
2367543
6c5965f
8bece92
df94a1f
459667f
937eeda
a58b62f
00e2e8b
f4fab4c
7c50fb9
5f4c6a7
51063c2
4c02fdd
afeb903
088f812
82dcdeb
103d8ff
08bbd6a
a4cfee0
3e34fc0
5fa4a62
a3ca835
cf89635
7b68456
08d0d85
a261f7f
1a19f9f
0582ed6
876eb61
9deaba3
e6656e6
6c9f4fc
b5b0150
1b92ecf
1f7fac4
ce96056
7c0ea2e
4b315ae
e169505
83143e3
ccf50bd
de0b52a
9bcabf2
d02b243
f4100c3
9989478
ee2149f
e5ac9fb
b1a8092
51339dd
1a763e6
126c0a3
1396736
a9e89eb
aa597f5
3d207b7
f72c533
ec60523
3f96eaf
403135a
0c6ed63
9e50c6b
f5138d7
6e29f2e
485d09e
ed4628f
9d0514c
fec3b8d
983fa20
c9398f7
5d009a6
b4617b6
b863f3c
ac3d49c
2acff4b
fb6d52e
a3fab98
bbe1ce8
1fb5556
b7df9e8
535e608
5335c01
311eb07
4daf341
05e3072
e91f1eb
ddac28c
0ee75f0
2d434ce
8e5b857
8442e8b
45ae4a6
98014ad
ba5d0a7
b23c8d5
44530d7
bc7737f
bdfd835
4c75ab9
7482b74
3edf67e
360863b
760c061
11eb85e
7fc9830
0513f07
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,9 +24,14 @@ env: | |
notifications: | ||
email: | ||
recipients: | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
#- [email protected] | ||
#- [email protected] | ||
# on_success: [always|never|change] # default: change | ||
# on_failure: [always|never|change] # default: always | ||
on_success: change | ||
on_success: always | ||
on_failure: always |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,9 @@ def index | |
redirect_to my_deliverables_path(current_user) | ||
end | ||
|
||
|
||
def grading_queue_for_course | ||
|
||
@course = Course.find(params[:course_id]) | ||
|
||
if @course.grading_rule.nil? | ||
|
@@ -26,8 +28,13 @@ def grading_queue_for_course | |
flash.now[:error] = I18n.t(:default_grading_rule_for_course) | ||
end | ||
|
||
if (current_user.is_admin? || @course.faculty.include?(current_user)) | ||
if current_user.is_admin? | ||
@deliverables = Deliverable.where(:course_id => @course.id).all | ||
|
||
elsif @course.faculty.include?(current_user) | ||
# Isil - Team Turing | ||
@deliverables = Deliverable.new.grading_queue_display(params[:course_id], current_user.id) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure why we are creating a new deliverable |
||
else | ||
has_permissions_or_redirect(:admin, root_path) | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,68 @@ class Deliverable < ActiveRecord::Base | |
after_save :inaccurate_course_and_assignment_check | ||
|
||
|
||
# Grading queue | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment adds no value |
||
def grading_queue_display(course_id, faculty_id, options = nil) | ||
|
||
# Default grading queue filters | ||
options = {"ungraded" => 1, "drafted" => 0, "graded" => 0, "is_my_teams" => 1, "deliverable_name" => ''} if options.nil? | ||
|
||
queue = nil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. queue = [] |
||
|
||
# Check: Are there teams in this course? If there are, and the "filter by teams is on", filter by teams | ||
# or by individuals in a faculty's teams. | ||
|
||
course_has_teams = Team.find_by_sql(["SELECT * FROM teams WHERE course_id = ? LIMIT 1", course_id]) | ||
|
||
if course_has_teams.empty? | ||
# Show them everyone in the course | ||
#queue = Deliverable.where(:course_id => course_id).all | ||
queue = Deliverable.find_by_sql(["SELECT * FROM deliverables WHERE course_id = ?", course_id]) | ||
|
||
else | ||
# By default, the faculty see their teams or individuals in their teams with ungraded deliverables | ||
if options['is_my_teams'] == 1 | ||
|
||
sql = "SELECT a.name AS assignment_name, d.id AS deliverable_id, d.updated_at, a.task_number, t.name AS owner_name, d.creator_id, dav.attachment_file_name AS attachment_file_name, a.is_team_deliverable, dav.id AS attachment_versions, c.name AS course_name | ||
FROM deliverables d | ||
INNER JOIN assignments a ON d.assignment_id = a.id | ||
INNER JOIN teams t ON t.id = d.team_id | ||
INNER JOIN courses c ON c.id = a.course_id | ||
INNER JOIN deliverable_attachment_versions dav ON dav.deliverable_id = d.id | ||
WHERE d.course_id = ? AND t.primary_faculty_id = ?" | ||
|
||
#queue = Deliverable.find_by_sql([sql, course_id, assignment_id]) | ||
queue = Deliverable.find_by_sql([sql, course_id, faculty_id]) | ||
|
||
# This course may have teams, but this deliverable may not be a team deliverable. In that case: | ||
if queue.nil? | ||
sql = "SELECT a.name AS assignment_name, d.updated_at AS last_updated, a.task_number, | ||
u.human_name AS owner_name, d.creator_id, dav.attachment_file_name AS attachment_file_name, a.is_team_deliverable, | ||
dav.id AS attachment_versions | ||
FROM deliverables d | ||
INNER JOIN assignments a ON d.assignment_id = a.id | ||
INNER JOIN users u ON u.id = d.creator_id | ||
INNER JOIN deliverable_attachment_versions dav ON dav.deliverable_id = d.id | ||
WHERE d.course_id = ? AND a.id = ?" | ||
|
||
queue = Deliverable.find_by_sql([sql, course_id, assignment_id]) | ||
|
||
end # end 'Teams in course but individual deliverable' | ||
|
||
else | ||
|
||
# Do not filter by my teams, show everyone | ||
#queue = Deliverable.where(:course_id => course_id).all | ||
queue = Deliverable.find_by_sql(["SELECT * FROM deliverables WHERE course_id = ?", course_id]) | ||
|
||
end # end 'Filter by my teams' | ||
|
||
end # end 'Course has teams ' | ||
|
||
return queue | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method is getting very long. How do we simplify? I suspect we need to move the sql into helper methods. |
||
end | ||
|
||
# To get the owner of the deliverable | ||
def unique_course_task_owner? | ||
if self.is_team_deliverable? | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that we want admin to supersede the faculty role. If a faculty is also an admin, does this mean that they can't see their own team's deliverables?