mumuki-domain 7.2.1 → 7.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a3b10ef542bfd3dbee5d1eb1118373c96c6b736805189bed7246b594363cfbe1
4
- data.tar.gz: 24a81d7f77f70dcadf65bb1af620f1bebf5e8928650d2e8db3353f47150ce236
3
+ metadata.gz: 1e4000eb54a24a50ced9f8b58ce44db2c4bd93a12737f5e678abaa8bd631d82c
4
+ data.tar.gz: e0f5c3d5752a2aaa0764f9f8dbe53a774f474ac7b3baf047680e41d75f5adaf2
5
5
  SHA512:
6
- metadata.gz: 809c9f60a6b2f312610aa7fa428f6957bcd8b8c8c27b59b6c292592bf0e81f938c9085ad7e0343ddaed18d491b0045e7e2d8a51207a291d2d42073e74fff9ef3
7
- data.tar.gz: ab5e7b329351202eb30b5392ba3f5c8c4074e903b4b8498418bdd7fa5650b485bda66040f18e6cbb59567edf9915da808dc15d4c9d0cb6fe160d8acd5874bcce
6
+ metadata.gz: 4de888c6f4bcd0670b807acb4c3935c0a335a1b101454e2ce17ada86ff8645cc9a48d4724404e2c4f3d1849aaba3f03dcbc75a0e725d3f628ee191ce3555ca89
7
+ data.tar.gz: 3b0795f583e057f1c6bfc2586bf11cde38ce7ae2751b03ec4c0a93790e49cd34446f1985312bab89bc36bad04ad09eef85326ed93236f2323b84e3083cbe2f8b
@@ -40,6 +40,12 @@ class Assignment < Progress
40
40
  alias_method :user, :submitter
41
41
 
42
42
  after_save :dirty_parent_by_submission!, if: :completion_changed?
43
+ before_save :set_current_organization, unless: :organization
44
+
45
+ # TODO: Momentary as some assignments may not have an associated organization
46
+ def set_current_organization
47
+ self.organization = Organization.current
48
+ end
43
49
 
44
50
  def completion_changed?
45
51
  completed_before_last_save? != completed?
@@ -208,11 +214,6 @@ class Assignment < Progress
208
214
  exercise.files_for(current_content)
209
215
  end
210
216
 
211
- def save!(*)
212
- self.organization = Organization.current
213
- super
214
- end
215
-
216
217
  private
217
218
 
218
219
  def update_submissions_count!
@@ -26,4 +26,8 @@ class Chapter < ApplicationRecord
26
26
  def structural_parent
27
27
  book
28
28
  end
29
+
30
+ def pending_siblings_for(user)
31
+ book.pending_chapters(user)
32
+ end
29
33
  end
@@ -12,9 +12,10 @@ module SiblingsNavigation
12
12
  structural_parent.structural_children
13
13
  end
14
14
 
15
- def pending_siblings_for(user, organization=Organization.current)
16
- siblings.reject { |it| it.progress_for(user, organization).completed? }
17
- end
15
+ #TODO reestablish this after indicators reliably linked to assignments
16
+ # def pending_siblings_for(user, organization=Organization.current)
17
+ # siblings.reject { |it| it.progress_for(user, organization).completed? }
18
+ # end
18
19
 
19
20
  # Names
20
21
 
@@ -216,6 +216,10 @@ class Exercise < ApplicationRecord
216
216
  guide.settings.deep_merge super
217
217
  end
218
218
 
219
+ def pending_siblings_for(user)
220
+ guide.pending_exercises(user)
221
+ end
222
+
219
223
  private
220
224
 
221
225
  def evaluation_class
data/app/models/lesson.rb CHANGED
@@ -17,4 +17,8 @@ class Lesson < ApplicationRecord
17
17
  def structural_parent
18
18
  topic
19
19
  end
20
+
21
+ def pending_siblings_for(user)
22
+ topic.pending_lessons(user)
23
+ end
20
24
  end
data/app/models/topic.rb CHANGED
@@ -41,6 +41,18 @@ class Topic < Content
41
41
  dup.lessons = lessons.map { |lesson| lesson.guide.fork_to!(organization, syncer, quiet: true).as_lesson_of(dup) }
42
42
  end
43
43
 
44
+ def pending_lessons(user)
45
+ guides.
46
+ joins('left join public.exercises exercises
47
+ on exercises.guide_id = guides.id').
48
+ joins("left join public.assignments assignments
49
+ on assignments.exercise_id = exercises.id
50
+ and assignments.submitter_id = #{user.id}
51
+ and assignments.submission_status = #{Mumuki::Domain::Status::Submission::Passed.to_i}").
52
+ where('assignments.id is null').
53
+ group('public.guides.id', 'lessons.number').map(&:lesson)
54
+ end
55
+
44
56
  private
45
57
 
46
58
  def lesson_for(slug)
@@ -41,6 +41,7 @@ class Mumuki::Domain::Submission::Base
41
41
 
42
42
  def save_submission!(assignment)
43
43
  assignment.content = content
44
+ assignment.organization = Organization.current
44
45
  assignment.save!
45
46
  end
46
47
 
@@ -1,5 +1,5 @@
1
1
  module Mumuki
2
2
  module Domain
3
- VERSION = '7.2.1'
3
+ VERSION = '7.2.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumuki-domain
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.1
4
+ version: 7.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-16 00:00:00.000000000 Z
11
+ date: 2020-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails