Skip to content

Commit

Permalink
Merge pull request #434 from autolab/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Ilter committed Mar 28, 2015
2 parents b93d08d + a0676e4 commit 6c45b6f
Show file tree
Hide file tree
Showing 110 changed files with 2,237 additions and 3,690 deletions.
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ Metrics/LineLength:
- http
- https

Metrics/MethodLength:
CountComments: false # count full line comments?
Max: 20

# Indent private/protected/public as deep as method definitions
Style/AccessModifierIndentation:
EnforcedStyle: outdent
Expand Down
68 changes: 34 additions & 34 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
# This configuration was generated by `rubocop --auto-gen-config`
# on 2015-03-13 14:29:24 -0400 using RuboCop version 0.29.1.
# on 2015-03-24 00:12:45 -0400 using RuboCop version 0.29.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 5
# Offense count: 4
Lint/AmbiguousOperator:
Enabled: false

# Offense count: 1
Lint/AmbiguousRegexpLiteral:
Enabled: false

# Offense count: 9
# Offense count: 6
# Configuration parameters: AllowSafeAssignment.
Lint/AssignmentInCondition:
Enabled: false

# Offense count: 6
# Offense count: 5
# Configuration parameters: AlignWith, SupportedStyles.
Lint/EndAlignment:
Enabled: false

# Offense count: 8
# Offense count: 6
Lint/Eval:
Enabled: false

# Offense count: 4
Lint/HandleExceptions:
Enabled: false

# Offense count: 7
# Offense count: 6
Lint/ParenthesesAsGroupedExpression:
Enabled: false

# Offense count: 41
# Offense count: 33
Lint/RescueException:
Enabled: false

Expand All @@ -47,65 +47,65 @@ Lint/ShadowingOuterLocalVariable:
Lint/UnderscorePrefixedVariableName:
Enabled: false

# Offense count: 2
# Offense count: 1
Lint/UnreachableCode:
Enabled: false

# Offense count: 27
# Offense count: 25
Lint/UselessAssignment:
Enabled: false

# Offense count: 125
# Offense count: 144
Metrics/AbcSize:
Max: 192
Max: 196

# Offense count: 5
# Offense count: 8
Metrics/BlockNesting:
Max: 6

# Offense count: 13
# Offense count: 15
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 1184
Max: 1152

# Offense count: 64
# Offense count: 72
Metrics/CyclomaticComplexity:
Max: 33
Max: 44

# Offense count: 376
# Offense count: 90
# Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength:
Max: 222

# Offense count: 147
# Offense count: 67
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 141
Max: 143

# Offense count: 2
# Offense count: 3
# Configuration parameters: CountKeywordArgs.
Metrics/ParameterLists:
Max: 6

# Offense count: 62
# Offense count: 67
Metrics/PerceivedComplexity:
Max: 37

# Offense count: 13
# Offense count: 9
# Configuration parameters: Include.
Rails/Output:
Enabled: false

# Offense count: 25
# Offense count: 30
# Configuration parameters: Include.
Rails/Validation:
Enabled: false

# Offense count: 3
# Offense count: 8
Style/AccessorMethodName:
Enabled: false

# Offense count: 8
# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/AndOr:
Expand All @@ -116,12 +116,12 @@ Style/AndOr:
Style/CaseIndentation:
Enabled: false

# Offense count: 6
# Offense count: 5
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/ClassAndModuleChildren:
Enabled: false

# Offense count: 5
# Offense count: 6
Style/ClassVars:
Enabled: false

Expand All @@ -130,7 +130,7 @@ Style/ClassVars:
Style/CommentAnnotation:
Enabled: false

# Offense count: 192
# Offense count: 181
Style/Documentation:
Enabled: false

Expand All @@ -148,17 +148,17 @@ Style/FileName:
Style/For:
Enabled: false

# Offense count: 7
# Offense count: 4
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/FormatString:
Enabled: false

# Offense count: 28
# Offense count: 25
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Enabled: false

# Offense count: 77
# Offense count: 55
# Configuration parameters: MaxLineLength.
Style/IfUnlessModifier:
Enabled: false
Expand All @@ -172,7 +172,7 @@ Style/MethodName:
Style/MultilineTernaryOperator:
Enabled: false

# Offense count: 15
# Offense count: 13
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
Style/Next:
Enabled: false
Expand All @@ -181,7 +181,7 @@ Style/Next:
Style/OneLineConditional:
Enabled: false

# Offense count: 11
# Offense count: 10
# Configuration parameters: NamePrefix, NamePrefixBlacklist.
Style/PredicateName:
Enabled: false
Expand All @@ -206,7 +206,7 @@ Style/Semicolon:
Style/SingleLineBlockParams:
Enabled: false

# Offense count: 145
# Offense count: 121
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/VariableName:
Enabled: false
30 changes: 12 additions & 18 deletions app/controllers/admins_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,26 @@
require "fileutils"
require "Statistics.rb"

##
# this controller contains methods for system-wise
# admin functionality
class AdminsController < ApplicationController
action_auth_level :show, :administrator
def show
end

action_auth_level :emailInstructors, :administrator
def emailInstructors
action_auth_level :email_instructors, :administrator
def email_instructors
return unless request.post?

if request.post?
@cuds = CourseUserDatum.select(:user_id).distinct.joins(:course)
.where("courses.end_date > ? and instructor = 1", DateTime.now)

@cuds = CourseUserDatum.select(:user_id).distinct.joins(:course)
.where("courses.end_date > ? and instructor = 1", DateTime.now)

# select(:user_id).distinct.where(:instructor=>true)
# @cuds = Course.where(:temporal_status => :current ).instructors
bccString = makeDlist(@cuds)

@email = CourseMailer.system_announcement(
params[:from],
bccString,
params[:subject],
params[:body])
@email.deliver

end
@email = CourseMailer.system_announcement(
params[:from],
make_dlist(@cuds),
params[:subject],
params[:body])
@email.deliver
end
end
5 changes: 3 additions & 2 deletions app/controllers/annotations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ def destroy
respond_with(@course, @assessment, @submission, @annotation)
end

private
private

def annotation_params
params[:annotation].delete(:id)
params[:annotation].delete(:submission_id)
params[:annotation].delete(:created_at)
params[:annotation].delete(:updated_at)
params.require(:annotation).permit(:filename, :position, :line, :text, :submitted_by, :comment, :value, :problem_id)
params.require(:annotation).permit(:filename, :position, :line, :text, :submitted_by,
:comment, :value, :problem_id)
end

def set_annotation
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/announcements_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ def destroy

def set_announcement
@announcement = @course.announcements.find(params[:id])
if @announcement.system && !@cud.user.administrator?
flash[:error] = "You don't have permission to access system announcments."
redirect_to(action: :index) && return
end
return unless @announcement.system && !@cud.user.administrator?

flash[:error] = "You don't have permission to access system announcments."
redirect_to(action: :index) && return
end

def announcement_params
Expand Down
Loading

0 comments on commit 6c45b6f

Please sign in to comment.