Skip to content

Commit d39b650

Browse files
committed
Add backfill workers for Post Recommendation activities
1 parent 7fd72cc commit d39b650

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# frozen_string_literal: true
2+
3+
module StudentLearningSequences
4+
module Backfill
5+
class RecommendationAssignmentWorker < BaseWorker
6+
def run_backfill
7+
backfill_classroom_units(recommendation_classroom_units)
8+
end
9+
10+
def recommendation_classroom_units
11+
ClassroomUnit.joins(unit_unscoped: { unit_template: :recommendations })
12+
.where(unit: {
13+
unit_template: {
14+
recommendations: {
15+
activity_id: post_diagnostic_activity_ids
16+
}
17+
}
18+
})
19+
end
20+
end
21+
end
22+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# frozen_string_literal: true
2+
3+
module StudentLearningSequences
4+
module Backfill
5+
class RecommendationCompletionWorker < BaseWorker
6+
def run_backfill
7+
backfill_activity_sessions(recommendation_activity_sessions)
8+
end
9+
10+
def recommendation_activity_sessions
11+
ActivitySession.unscoped.joins(classroom_unit: {
12+
unit_unscoped: {
13+
unit_template: :recommendations
14+
}
15+
}).where(classroom_unit: {
16+
unit: {
17+
unit_template: {
18+
recommendations: {
19+
activity_id: post_diagnostic_activity_ids
20+
}
21+
}
22+
}
23+
})
24+
end
25+
end
26+
end
27+
end

0 commit comments

Comments
 (0)