Skip to content

Commit b8dfea2

Browse files
committed
fixed mismatch and turn off requirements for time tracking
1 parent be5ff5b commit b8dfea2

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

app/controllers/odsa_user_time_tracking_controller.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class OdsaUserTimeTrackingController < ApplicationController
88
# POST /odsa_user_time_tracking/create
99
def create
1010
failed_to_save = false
11-
errors = []
11+
error_msgs = []
1212
# puts params[:modulesTracking]
1313
params[:modulesTracking].each_pair do |key, event|
1414
# puts event
@@ -31,9 +31,7 @@ def create
3131
total_time: event[:totalTime],
3232
sections_time: event[:sectionsTime]
3333
)
34-
if @user_time_tracking.save
35-
failed_to_save = false
36-
else
34+
if !@user_time_tracking.save
3735
failed_to_save = true
3836
error_msgs << @user_time_tracking.errors.full_messages
3937
end

app/models/odsa_user_time_tracking.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@
3434
class OdsaUserTimeTracking < ApplicationRecord
3535
#~ Relationships ............................................................
3636
belongs_to :user
37-
belongs_to :inst_book
38-
belongs_to :inst_book_section_exercise
39-
belongs_to :inst_course_offering_exercise
40-
belongs_to :inst_module
41-
belongs_to :inst_chapter
42-
belongs_to :inst_module_version
43-
belongs_to :inst_module_section_exercise
37+
belongs_to :inst_book, optional: true
38+
belongs_to :inst_book_section_exercise, optional: true
39+
belongs_to :inst_course_offering_exercise, optional: true
40+
belongs_to :inst_module, optional: true
41+
belongs_to :inst_chapter, optional: true
42+
belongs_to :inst_module_version, optional: true
43+
belongs_to :inst_module_section_exercise, optional: true
4444

4545
#~ Validation ...............................................................
4646
validate :required_fields

0 commit comments

Comments
 (0)