• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

expertiza / expertiza / #19768

08 Apr 2026 06:09AM UTC coverage: 46.923% (+15.2%) from 31.694%
#19768

push

web-flow
Merge pull request #2976 from expertiza/production_deployment

Production deployment

6541 of 13940 relevant lines covered (46.92%)

7.44 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

84.0
/app/models/assignment_node.rb
1
# Node type for Assignments
2

3
# Author: ajbudlon
4
# Date: 7/18/2008
5

6
class AssignmentNode < Node
1✔
7
  belongs_to :assignment, class_name: 'Assignment', foreign_key: 'node_object_id'
1✔
8
  belongs_to :node_object, class_name: 'Assignment', foreign_key: 'node_object_id'
1✔
9
  # Returns the table in which to locate Assignments
10
  def self.table
1✔
11
    'assignments'
×
12
  end
13

14
  # parametersi:
15
  #   sortvar: valid strings - name, created_at, updated_at, directory_path
16
  #   sortorder: valid strings - asc, desc
17
  #   user_id: instructor id for assignment
18
  #   parent_id: course_id if subset
19

20
  # returns: list of AssignmentNodes based on query
21
  def self.get(sortvar = nil, sortorder = nil, user_id = nil, show = nil, parent_id = nil, _search = nil)
1✔
22
    if show
8✔
23
      conditions = if User.find(user_id).role.name != 'Teaching Assistant'
×
24
                     'assignments.instructor_id = ?'
×
25
                   else
26
                     'assignments.course_id in (?)'
×
27
                   end
28
    else
29
      if User.find(user_id).role.name != 'Teaching Assistant'
8✔
30
        conditions = '(assignments.private = 0 or assignments.instructor_id = ?)'
1✔
31
        values = user_id
1✔
32
      else
33
        conditions = '(assignments.private = 0 or assignments.course_id in (?))'
7✔
34
        values = Ta.get_mapped_courses(user_id)
7✔
35
      end
36
    end
37
    conditions += " and course_id = #{parent_id}" if parent_id
8✔
38
    sortvar ||= 'created_at'
8✔
39
    sortorder ||= 'desc'
8✔
40
    find_conditions = [conditions, values]
8✔
41
    includes(:assignment).where(find_conditions).order("assignments.#{sortvar} #{sortorder}")
8✔
42
  end
43

44
  # Indicates that this object is always a leaf
45
  def is_leaf
1✔
46
    true
×
47
  end
48

49
  def get_name
1✔
50
    @assign_node ? @assign_node.name : Assignment.find_by(id: node_object_id).try(:name)
9✔
51
  end
52

53
  def get_directory
1✔
54
    @assign_node ? @assign_node.directory_path : Assignment.find_by(id: node_object_id).try(:directory_path)
9✔
55
  end
56

57
  def get_creation_date
1✔
58
    @assign_node ? @assign_node.created_at : Assignment.find_by(id: node_object_id).try(:created_at)
9✔
59
  end
60

61
  def get_modified_date
1✔
62
    @assign_node ? @assign_node.updated_at : Assignment.find_by(id: node_object_id).try(:updated_at)
9✔
63
  end
64

65
  def get_course_id
1✔
66
    @assign_node ? @assign_node.course_id : Assignment.find_by(id: node_object_id).try(:course_id)
9✔
67
  end
68

69
  def belongs_to_course?
1✔
70
    !get_course_id.nil?
×
71
  end
72

73
  def get_instructor_id
1✔
74
    @assign_node ? @assign_node.instructor_id : Assignment.find_by(id: node_object_id).try(:instructor_id)
45✔
75
  end
76

77
  def retrieve_institution_id
1✔
78
    Assignment.find_by(id: node_object_id).try(:institution_id)
9✔
79
  end
80

81
  def get_private
1✔
82
    Assignment.find_by(id: node_object_id).try(:private)
×
83
  end
84

85
  def get_max_team_size
1✔
86
    Assignment.find_by(id: node_object_id).try(:max_team_size)
9✔
87
  end
88

89
  def get_is_intelligent
1✔
90
    Assignment.find_by(id: node_object_id).try(:is_intelligent)
9✔
91
  end
92

93
  def get_require_quiz
1✔
94
    Assignment.find_by(id: node_object_id).try(:require_quiz)
9✔
95
  end
96

97
  def get_allow_suggestions
1✔
98
    Assignment.find_by(id: node_object_id).try(:allow_suggestions)
9✔
99
  end
100

101
  # Gets any TeamNodes associated with this object
102
  def get_teams
1✔
103
    TeamNode.get(node_object_id)
×
104
  end
105
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc