Skip to content
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

Pull request for Mass Assignment - Team Ruby Racer #244

Open
wants to merge 178 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
178 commits
Select commit Hold shift + click to select a range
5405f60
Basic error checking the run_rspec.sh
tushar-dadlani Oct 3, 2013
5c17a7d
Added plugin for find_mass_assignment
tushar-dadlani Oct 3, 2013
3a2dbd1
Updated everyone's email addresses in .travis.yml
tushar-dadlani Oct 3, 2013
244ae09
Merge branch 'master' of https://github.com/professor/whiteboard into…
tushar-dadlani Oct 9, 2013
0cdb088
Defaulting the listed teams to display only current logged in faculty…
tushar-dadlani Oct 10, 2013
7e6faa3
sketch front end code for grading queue
innovateboliu Oct 11, 2013
e8dfc4d
Test cases for advisor filtering
cllin Oct 12, 2013
5818cb6
Remove unneeded Factory item
cllin Oct 12, 2013
7b4583d
Remove unneed files
cllin Oct 12, 2013
9206aa9
Comment out test cases
cllin Oct 12, 2013
58eba0e
grading queue filter by team belonging
innovateboliu Oct 14, 2013
28f6036
added seeds for fse
tushar-dadlani Oct 14, 2013
6ada701
Merge branch 'dev'
tushar-dadlani Oct 14, 2013
ee43ca0
Merge branch 'master' of https://github.com/tushar-dadlani/teamrubyra…
tushar-dadlani Oct 14, 2013
7cf7c4a
New test case
cllin Oct 14, 2013
229f5ff
Fixed seed bugs that seed same name prof and student
tushar-dadlani Oct 14, 2013
d0fbb96
Merge branch 'master' of https://github.com/tushar-dadlani/teamrubyra…
tushar-dadlani Oct 14, 2013
56e845d
add http get
innovateboliu Oct 15, 2013
72bb223
Added default view for my "professor's" teams
tushar-dadlani Oct 15, 2013
2ada8b9
task 1 front end
innovateboliu Oct 15, 2013
122514e
clean code
innovateboliu Oct 15, 2013
9079841
task 1 front end code
innovateboliu Oct 15, 2013
6bcab0c
add tab
innovateboliu Oct 15, 2013
e62e93d
Customized deliverables and added pending test cases
Oct 15, 2013
5af4413
Merge branch 'deliverables_filter_faculty'
tushar-dadlani Oct 15, 2013
b402a9d
Updating seed data for development db
suryakiranl Oct 15, 2013
b5d96d9
Added changes to get individual deliverables
tushar-dadlani Oct 15, 2013
97a96fc
Added comments with logic for GET parameters on deliverables listing
tushar-dadlani Oct 16, 2013
9a1e7a0
merge controller changes for individual deliverable
tushar-dadlani Oct 16, 2013
e5579ba
merge deliverables_controller
innovateboliu Oct 16, 2013
8bdb7b8
Seed data changes
suryakiranl Oct 16, 2013
eede294
Merge branch 'master' of github.com:tushar-dadlani/teamrubyracer-whit…
tushar-dadlani Oct 17, 2013
a3039e0
Removed code from views and fixed controller code that failed due to …
tushar-dadlani Oct 17, 2013
8f83d1e
customized seeds data
innovateboliu Oct 17, 2013
ebd723d
User Story 2 - Task 1
suryakiranl Oct 17, 2013
57cc45e
Added tushar's user id to the seed data.
tushar-dadlani Oct 17, 2013
bfa20ad
Color Coding the grades
suryakiranl Oct 18, 2013
248f639
merge
innovateboliu Oct 18, 2013
0639ed5
Merge branch 'master' of https://github.com/tushar-dadlani/teamrubyra…
innovateboliu Oct 18, 2013
45ad0bd
Added strong parameter gem
tushar-dadlani Oct 18, 2013
adddb47
change grading queue table according to different assignment selection
innovateboliu Oct 19, 2013
4fc6fba
Back end changes to use custom SQL
suryakiranl Oct 19, 2013
7fb5243
merge
innovateboliu Oct 19, 2013
c035d8b
merge
innovateboliu Oct 19, 2013
dc3f5f5
fix grading status checkbox
innovateboliu Oct 19, 2013
aed4a04
Commenting out current_user method in application_controller
suryakiranl Oct 19, 2013
3c7ebca
Fixing Give grade and Review grade link navigations
suryakiranl Oct 19, 2013
1ab23d0
Sample Capybara test with factories running for a single deliverable
tushar-dadlani Oct 19, 2013
1946e9e
Merge branch 'filter_factory'
tushar-dadlani Oct 19, 2013
31d2d98
removed comments from the filter_deliverables_team.rb
tushar-dadlani Oct 19, 2013
b34ebe7
Test cases for grading queue
cllin Oct 20, 2013
4044582
Fixing failed build
cllin Oct 20, 2013
45d0e58
Fixing failed build
cllin Oct 20, 2013
fb4bd6c
Comment out error-causing lines
cllin Oct 20, 2013
c9358a2
Change before:all to before:each
cllin Oct 20, 2013
f67879d
added the assignment to a course for a the test case
tushar-dadlani Oct 21, 2013
d3fa9ed
Merge branch 'filter_factory'
tushar-dadlani Oct 21, 2013
e6e9fd6
More test cases
cllin Oct 21, 2013
315e64b
Test cases for story 1 and coloring grading status
cllin Oct 21, 2013
9bc332d
Change before:all to before:each
cllin Oct 21, 2013
5f9ef1c
Fixed mass assignment for 5 models.
tushar-dadlani Oct 23, 2013
cb84c7c
Merge branch 'mass_assignment'
tushar-dadlani Oct 23, 2013
6a4c371
Added TODO test cases to the broken courses_controller
tushar-dadlani Oct 24, 2013
ba2b303
Deliverables test cases
suryakiranl Oct 25, 2013
65d07a0
Implementing suggestions by Todd in VP Meeting
suryakiranl Oct 25, 2013
e0e4f05
Commenting out current user method
suryakiranl Oct 25, 2013
c42ce3f
Removing Assignment order from the combo box listing Assignments
suryakiranl Oct 27, 2013
2779cf8
Remove logic to select the last item from the Assignment list
suryakiranl Oct 27, 2013
7068a2a
New query helper class for deliverables page
suryakiranl Oct 27, 2013
c26db0a
Using the deliverable query helper class
suryakiranl Oct 27, 2013
a7ea735
Using the team and individual deliverables from controller
suryakiranl Oct 27, 2013
4725708
Clean up existing Java Script code
suryakiranl Oct 28, 2013
aa38963
Search feature working
suryakiranl Oct 28, 2013
46614d1
Showing a readble message when no deliverables are available
suryakiranl Oct 28, 2013
5c0bd00
Filter an results are in sync now
suryakiranl Oct 28, 2013
4a47e95
Showing readable message if there are no results
suryakiranl Oct 28, 2013
0670060
deliverables_controller
tushar-dadlani Oct 28, 2013
eff174e
Delete filter_deliverables_team.rb
suryakiranl Oct 28, 2013
4006771
Rename grading_queue_for_course.html.erb_spec.rb to grading_queue_for…
suryakiranl Oct 28, 2013
d558f4a
Include require in deliverables_controller.rb
suryakiranl Oct 28, 2013
f0d7987
Fixed the breaking test cases for courses controller
tushar-dadlani Oct 28, 2013
ccac753
Protected against strong parameters
tushar-dadlani Oct 28, 2013
bb487bf
Capybara tests for User Story 1 complete
suryakiranl Oct 28, 2013
1915fe6
Test Cases for User Story 3 are complete
suryakiranl Oct 28, 2013
560d3ca
add test cases for clicking All Teams radio button
innovateboliu Oct 29, 2013
8d3667d
Travis failure
innovateboliu Oct 29, 2013
85f145f
fix Travis failure
innovateboliu Oct 29, 2013
0490f95
comment out all changes
innovateboliu Oct 29, 2013
920aff2
Improving the individual deliverables query
suryakiranl Oct 29, 2013
c508103
Improving individual delierables query
suryakiranl Oct 29, 2013
fde383d
Show the no rows message if there is not table at all too
suryakiranl Oct 29, 2013
1bd10c1
Fixing test cases
suryakiranl Oct 29, 2013
b46bc79
Changing color(h3) in GQ page
Oct 30, 2013
80e2fc6
Changed the color of h3 in GQ
Oct 30, 2013
0fa4190
Changed color of h3 in GQ Merge branch 'branch_1'
Oct 30, 2013
be62d5f
removed temp files
tushar-dadlani Oct 30, 2013
fb09fec
test cases for showing all teams after user clicking All Teams
innovateboliu Oct 30, 2013
8458242
Changes made to grading spec file
Oct 31, 2013
4b10ce7
User stories for Iteration 2 complete
suryakiranl Oct 31, 2013
5f6c4da
Changing view to show the no deliverables as regular text and not as h3
suryakiranl Oct 31, 2013
d30a486
using ALL_TEAMS and MY_TEAMS constant values in controller
suryakiranl Oct 31, 2013
cd8bf39
Merge branch 'master' of github.com:tushar-dadlani/teamrubyracer-whit…
tushar-dadlani Nov 1, 2013
ef34f8c
Fixed the timezone causing the reminder_handler test cases to fail
tushar-dadlani Nov 2, 2013
c28fb2d
Delete grading_q_tests_spec.rb
suryakiranl Nov 3, 2013
6d669e3
Improving team and individual deliverables SQL queries
suryakiranl Nov 6, 2013
becaf9a
Added code comments
suryakiranl Nov 6, 2013
9332afe
Mass assignment code changes for 5 models
suryakiranl Nov 7, 2013
01dcc80
Adding strong parameters to Gemfile
suryakiranl Nov 7, 2013
3ee7be5
Added TODO test cases to the broken courses_controller
suryakiranl Nov 7, 2013
6607e7b
Merging all changes from Tushar's repo
suryakiranl Nov 7, 2013
2fc11c8
open grading detail in the grading queue page, need CSS and close fea…
innovateboliu Nov 6, 2013
425b3b1
New test cases
cllin Nov 6, 2013
f9ee79b
add feature of close grade detail in grading queue page
innovateboliu Nov 6, 2013
e2e0bd2
modify logic of closing popup table to only using javascript
innovateboliu Nov 7, 2013
15d60d3
#1 fix bug of clicking on some row the whole table layout changed. #2…
innovateboliu Nov 7, 2013
1310a5d
1.Adopted old query calls 2.Change 'before:each' to 'before:all'
cllin Nov 8, 2013
c7936ee
1.Error fixed 2.Test case for new story is still pending
cllin Nov 8, 2013
527a56d
Test case for story: render grading page in grading queue
cllin Nov 9, 2013
9f36e47
Refactor test cases
cllin Nov 10, 2013
9a0df7b
Refactor test cases
cllin Nov 10, 2013
88e7b6b
use ajax for save grad, basically everything is on the same page now
innovateboliu Nov 10, 2013
c1a314e
Test case for giving and saving grades in grading queue
cllin Nov 13, 2013
ebc0fd4
Fixing queries that fetch individual and team deliverables. Also upda…
suryakiranl Nov 14, 2013
448492b
Merging changes from Bo
suryakiranl Nov 14, 2013
33a7ce3
merge new_grading_queue_page to master
innovateboliu Nov 14, 2013
c52da39
should not checkin
innovateboliu Nov 14, 2013
739692f
small twisting
innovateboliu Nov 14, 2013
b750a10
comment out current_user
innovateboliu Nov 14, 2013
1b856c3
Test case for story Show the Latest Assignment
cllin Nov 14, 2013
37e4abf
Removing header with in give grade and back to pending list link
suryakiranl Nov 15, 2013
de6cb38
Adding course reference to teams and fixing build failure errors
suryakiranl Nov 15, 2013
134683b
Implemented score validation
cllin Nov 18, 2013
02336d3
1.Improve score validation 2.Prompt for unsaved chnages
cllin Nov 19, 2013
06da21c
1.Minor fix on score validation 2.'Unsaved' prompt in progress
cllin Nov 19, 2013
d5ce862
added back-to-top button
tushar-dadlani Nov 20, 2013
576ba69
Merge branch 'master' of github.com:tushar-dadlani/teamrubyracer-whit…
tushar-dadlani Nov 20, 2013
74b4bb4
Changes made after dividing course model into service. Service create…
Nov 21, 2013
f5c4265
commenting logging in
Nov 21, 2013
420d21b
Showing grading color code with check boxes, and with values on each …
suryakiranl Nov 21, 2013
33fd1d4
Merge branch 'master' of github.com:tushar-dadlani/teamrubyracer-whit…
suryakiranl Nov 21, 2013
3320e2d
Modifying test case which expected Indicator column name - as compare…
suryakiranl Nov 21, 2013
3ba40a8
Implemented: 1.Score validation 2.'Unsaved changes' prompt
cllin Nov 21, 2013
392f3b3
Merge branch 'master' of https://github.com/tushar-dadlani/teamrubyra…
cllin Nov 21, 2013
1cbca87
Removing code for a separate grading status indicator bar as it is in…
suryakiranl Nov 21, 2013
78e9972
Adding space between color code and notification text
suryakiranl Nov 21, 2013
2975b78
Highlight the current row in grading queue with gray background on hover
suryakiranl Nov 21, 2013
6a509b3
Making the grading queue table rows spacious by adding padding
suryakiranl Nov 21, 2013
bac270f
Providing border for the in page grading content displayed for the de…
suryakiranl Nov 21, 2013
19d72d3
Removed score validation
cllin Nov 23, 2013
e1836f4
Cleaning up the content in the dynamically loaded DIV when grading de…
suryakiranl Nov 23, 2013
31d2eed
Showing notification to user when deliverable details are being loaded
suryakiranl Nov 23, 2013
0f60bb4
Adding loading and closing deliverable details messages. Also include…
suryakiranl Nov 24, 2013
bfaba99
Updated test case to not look for text 'Attachment Version History' a…
suryakiranl Nov 24, 2013
e3388be
Making the open and close of deliverable status consistent between cl…
suryakiranl Nov 24, 2013
3b8cc02
Showing message when saving as draft/send email
suryakiranl Nov 24, 2013
ef127cd
CSS and alignment of buttons on grade page
suryakiranl Nov 24, 2013
5e5888d
Story Implemented: Show the latest assignment only
cllin Nov 26, 2013
e0c3c1f
Test case for Showing Latest Assignment updated, yet tested for the c…
cllin Nov 26, 2013
2733314
Updating the way latest deliverable is displayed
suryakiranl Nov 26, 2013
35857bd
Color differentiating headers from values in delierable details table
suryakiranl Nov 26, 2013
85e8dd1
Making my teams as default when no parameter is specified while loadi…
suryakiranl Nov 27, 2013
7306a6d
Showing a message when user changes selection between my teams and al…
suryakiranl Nov 27, 2013
fe48cf5
Making Show latest version and show all versions work consistenly for…
suryakiranl Nov 27, 2013
fa22378
Show deliverable header when logged in as student
suryakiranl Nov 27, 2013
c6975c5
Fixed the ajax issue for firefox
tushar-dadlani Nov 27, 2013
5cfc059
Mark test cases that require JavaScript as pending, for Travis does n…
cllin Nov 27, 2013
193dff6
Merge branch 'master' of https://github.com/tushar-dadlani/teamrubyra…
cllin Nov 27, 2013
7ea643e
Bug fixed
cllin Nov 27, 2013
a645b87
Added comments for test cases
cllin Nov 27, 2013
79225e1
Saving user preference of my_teams versus all_teams
suryakiranl Nov 27, 2013
f4d60e2
Updating test case for the default selection of My_teams in the gradi…
suryakiranl Nov 27, 2013
ac88e5f
Persisting assignment and grading status selections in the browser lo…
suryakiranl Nov 27, 2013
3badafa
Fixing page navigating away when click on Give Grade or Review Grade …
suryakiranl Nov 27, 2013
54493d2
fixed sortable value
tushar-dadlani Nov 29, 2013
8cf7f39
fixed failing test case caused by code changes
tushar-dadlani Nov 29, 2013
45fb210
removed course and course_service changes
tushar-dadlani Dec 2, 2013
eead50e
Search now works on existing filter
suryakiranl Dec 7, 2013
c965720
Final Code changes from Ruby Racer code
suryakiranl Dec 7, 2013
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
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ env:
notifications:
email:
recipients:
- [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
Expand Down
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ end
group :development, :test do
gem 'launchy'
gem 'taps'

# gem 'rake'

# see this link for details on which gem to install for debugger
Expand All @@ -93,6 +94,8 @@ group :development, :test do
# gem 'autotest-growl' if RUBY_PLATFORM =~ /darwin/

# gem 'test-unit' #, '1.2.3' #Downgrading so that autotest, rspec will work
# gem for strong parameters
gem 'strong_parameters', '0.2.1'
end


Expand Down
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ GEM
rack (>= 1.0)
spreadsheet (0.8.3)
ruby-ole (>= 1.0)
strong_parameters (0.2.1)
actionpack (~> 3.0)
activemodel (~> 3.0)
railties (~> 3.0)
taps (0.3.24)
rack (>= 1.0.1)
rest-client (>= 1.4.0, < 1.7.0)
Expand Down Expand Up @@ -309,6 +313,7 @@ DEPENDENCIES
seedbank
shoulda
spreadsheet
strong_parameters (= 0.2.1)
taps
thin
vestal_versions!
Expand Down
9 changes: 4 additions & 5 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,10 @@ def current_person
end
end

## In development, if you want to pretend to be a different user, you can set it easily here
# def current_user
# User.find_by_id 725 #Cecile
## User.last
# end
## In development, if you want to pretend to be a different user, you can set it easily here
#def current_user
# User.find_by_id 1
#end

def authenticate_user!
if !current_user
Expand Down
12 changes: 8 additions & 4 deletions app/controllers/courses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ def index
@all_courses = true
@courses = Course.order("year DESC, semester DESC, number ASC").all
@courses = @courses.sort_by { |c| -c.sortable_value } # note the '-' is for desc sorting

@registered_for_these_courses_during_current_semester = current_person.registered_for_these_courses_during_current_semester
@teaching_these_courses_during_current_semester = current_person.teaching_these_courses_during_current_semester
end
Expand Down Expand Up @@ -129,7 +128,7 @@ def create
authorize! :create, Course
@last_offering = Course.last_offering(params[:course][:number])
if @last_offering.nil?
@course = Course.new(:name => "New Course", :mini => "Both", :number => params[:course][:number])
@course = Course.new(course_params)
else
@course = @last_offering.copy_as_new_course
end
Expand All @@ -140,7 +139,6 @@ def create
respond_to do |format|
@course.updated_by_user_id = current_user.id if current_user
if @course.save

flash[:notice] = 'Course was successfully created.'
format.html { redirect_to edit_course_path(@course) }
format.xml { render :xml => @course, :status => :created, :location => @course }
Expand All @@ -164,10 +162,11 @@ def update
@course.configured_by_user_id = current_user.id
end

params.permit(:teachers => [])
params[:course][:faculty_assignments_override] = params[:teachers]
respond_to do |format|
@course.updated_by_user_id = current_user.id if current_user
@course.attributes = params[:course]
@course.attributes = course_params
if @course.save
flash[:notice] = 'Course was successfully updated.'
format.html { redirect_back_or_default(course_path(@course)) }
Expand Down Expand Up @@ -250,4 +249,9 @@ def index_core
format.xml { render :xml => @courses }
end
end

def course_params
params.require(:course).permit(:number,:name,:short_name,:semester,:mini, :year)
end

end
70 changes: 55 additions & 15 deletions app/controllers/deliverables_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class DeliverablesController < ApplicationController

layout 'cmu_sv'

before_filter :authenticate_user!
Expand All @@ -26,8 +25,36 @@ def grading_queue_for_course
flash.now[:error] = I18n.t(:default_grading_rule_for_course)
end

# This will be used for the 'Assignments including' select one box
@assignments = Assignment.fetch_submittable_assignments_by_course_id @course.id

if (current_user.is_admin? || @course.faculty.include?(current_user))
@deliverables = Deliverable.where(:course_id => @course.id).all
# By Default fetch data for my teams
team_selection = 1 # MY_TEAMS

# Check what the session value is ::
if( session[:team_selection] != nil )
team_selection = session[:team_selection]
#puts ">>> Team selection used from session preference: #{team_selection}"
end

# Remember that user selection overrides the session preference
if params[:teams] == "all_teams"
team_selection = 2 # ALL_TEAMS
end
if params[:teams] == 'my_teams'
team_selection = 1 # MY_TEAMS
end

# For future requests save this preference back in the session variable
session[:team_selection] = team_selection
#puts "<<< Team selection: #{team_selection} set to session as preference"

@team_deliverables = Deliverable.team_deliverables_for_grading_queue(@course, current_user, team_selection)
@individual_deliverables = Deliverable.individual_deliverables_for_grading_queue(@course, current_user, team_selection)

# Return all team deliverables and Individual deliverables for the current course in 1 object
@deliverables = [@team_deliverables.to_a, @individual_deliverables.to_a].flatten
else
has_permissions_or_redirect(:admin, root_path)
end
Expand Down Expand Up @@ -108,6 +135,8 @@ def new
@deliverable = Deliverable.new(:creator => current_user)
@courses = current_user.registered_for_these_courses_during_current_semester

# permitting parameters to protect against mass assignment
params.permit(:course_id)
if params[:course_id]
@deliverable.course_id = params[:course_id]
@assignments = Course.find(params[:course_id]).assignments.where(:is_submittable => true)
Expand Down Expand Up @@ -142,8 +171,9 @@ def edit
# POST /deliverables
# POST /deliverables.xml
def create

# Make sure that a file was specified
@deliverable = Deliverable.new(params[:deliverable])
@deliverable = Deliverable.new(deliverable_params)
@deliverable.creator = current_user
@deliverable.is_team_deliverable ? @deliverable.update_team : @deliverable.team = nil

Expand All @@ -164,7 +194,7 @@ def create
end
return
end
@attachment = DeliverableAttachment.new(params[:deliverable_attachment])
@attachment = DeliverableAttachment.new(deliverable_attachment_params)
@attachment.submitter = @deliverable.creator
@deliverable.attachment_versions << @attachment
@attachment.deliverable = @deliverable
Expand Down Expand Up @@ -205,20 +235,20 @@ def update
there_is_an_attachment = params[:deliverable_attachment][:attachment]
if there_is_an_attachment

@attachment = DeliverableAttachment.new(params[:deliverable_attachment])
@attachment = DeliverableAttachment.new(deliverable_attachment_params)
@attachment.submitter = current_user
@deliverable.attachment_versions << @attachment
@attachment.deliverable = @deliverable

if @attachment.valid? and @deliverable.valid? and @deliverable.update_attributes(params[:deliverable])
if @attachment.valid? and @deliverable.valid? and @deliverable.update_attributes(deliverable_params)
@deliverable.send_deliverable_upload_email(url_for(@deliverable))
flash[:notice] = 'Deliverable was successfully updated.'
redirect_to(@deliverable)
else
render :action => "edit"
end
else
if @deliverable.valid? and @deliverable.update_attributes(params[:deliverable])
if @deliverable.valid? and @deliverable.update_attributes(deliverable_params)
flash[:notice] = 'Deliverable was successfully updated.'
redirect_to(@deliverable)
else
Expand Down Expand Up @@ -289,14 +319,14 @@ def update_feedback
end

respond_to do |format|
if flash[:error].blank?
flash[:error] = nil
flash[:notice] = 'Feedback successfully saved.'
format.html {redirect_to(course_deliverables_path(@deliverable.course))}
else
flash[:error] = flash[:error].join("<br>")
format.html { redirect_to(@deliverable) }
end
if flash[:error].blank?
flash[:error] = nil
flash[:notice] = 'Feedback successfully saved.'
format.html {redirect_to(course_deliverables_path(@deliverable.course))}
else
flash[:error] = flash[:error].join("<br>")
format.html { redirect_to(@deliverable) }
end
end
end

Expand All @@ -313,4 +343,14 @@ def get_assignments_for_student
end
end

private
# Permitted params
def deliverable_params
params.require(:deliverable).permit(:assignment_id,:course_id)
end

def deliverable_attachment_params
params.require(:deliverable_attachment).permit(:comment,:attachment)
end

end
12 changes: 10 additions & 2 deletions app/controllers/teams_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,9 @@ def edit
# POST /courses/1/teams.xml
def create
if has_permissions_or_redirect(:staff, root_path)
params.permit(:persons => [])
params[:team][:members_override] = params[:persons]
@team = Team.new(params[:team])
@team = Team.new(team_params)

@team.course_id = params[:course_id]
@course = Course.find(params[:course_id])
Expand Down Expand Up @@ -214,7 +215,7 @@ def update
update_course_faculty_label

respond_to do |format|
@team.attributes = params[:team]
@team.attributes = team_params
if @team.save(params[:team])
flash[:notice] = 'Team was successfully updated.'
format.html { redirect_to(course_teams_path(@team.course)) }
Expand Down Expand Up @@ -291,11 +292,18 @@ def peer_evaluation_update


def update_course_faculty_label
params.permit(:primary_faculty_lable,:secondary_faculty_label)
@course = Course.find(params[:course_id])
if @course.primary_faculty_label != params[:primary_faculty_label] || @course.secondary_faculty_label != params[:seconday_faculty_label] then
@course.primary_faculty_label = params[:primary_faculty_label]
@course.secondary_faculty_label = params[:secondary_faculty_label]
@course.save
end
end

private

def team_params
params.require(:team).permit(:name,:section,:primary_faculty_id,:secondary_faculty_id,:email)
end
end
4 changes: 4 additions & 0 deletions app/models/assignment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,8 @@ def set_due_date date, hour, minute
self.due_date = "#{self.date} #{self.hour}:#{self.minute}"
end

def self.fetch_submittable_assignments_by_course_id course_id
Assignment.where(:course_id => course_id, :is_submittable => 't').order('id ASC')
end

end
1 change: 1 addition & 0 deletions app/models/course.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
# Course has grading rules. These include grading cut_offs for grade's like A,A-,B+ etc.

class Course < ActiveRecord::Base
include ActiveModel::ForbiddenAttributesProtection
has_many :teams
belongs_to :course_number
has_many :pages, :order => "position"
Expand Down
20 changes: 20 additions & 0 deletions app/models/deliverable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@


class Deliverable < ActiveRecord::Base
include ActiveModel::ForbiddenAttributesProtection
belongs_to :team
belongs_to :course

Expand Down Expand Up @@ -334,4 +335,23 @@ def inaccurate_course_and_assignment_check
end
end
end

# This method fetches team deliverables for the specified course and filter selections
def self.team_deliverables_for_grading_queue(course, current_user, team_selection)
sql_query = DeliverableQueryHelper.generate_query_for_team_deliverables(course, current_user, team_selection)
return execute_custom_sql(sql_query)
end

# This method fetches individual deliverables for the specified course and filter selections
def self.individual_deliverables_for_grading_queue(course, current_user, team_selection)
sql_query = DeliverableQueryHelper.generate_query_for_individual_deliverables(course, current_user, team_selection)
return execute_custom_sql(sql_query)
end

# This is a utility method to execute a fully formed custom SQL query
def self.execute_custom_sql(sql_query_str)
sql = self.sanitize_sql([sql_query_str])

return self.connection.execute(sql)
end
end
1 change: 1 addition & 0 deletions app/models/deliverable_attachment.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class DeliverableAttachment < ActiveRecord::Base
include ActiveModel::ForbiddenAttributesProtection
set_table_name "deliverable_attachment_versions"

belongs_to :submitter, :class_name => "User", :foreign_key => "submitter_id"
Expand Down
Loading