mumuki-domain 9.2.1 → 9.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/user.rb +14 -0
- data/app/models/user_stats.rb +2 -2
- data/lib/mumuki/domain/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b78b493d9f7e6314a746e22d17fe33c140dada6e77a9af84da850098180a1677
|
4
|
+
data.tar.gz: 9ed9017804d844c8a24540dcdf5c32d4ad78d8a28b186e3df1dbd83b845ff5cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84faddd371cc851bbb08155cddb140dd6a17eaa3920f73cf235950d3321f07be4dd4f44325708b582904ee4d1eac2b5c426be3afb7b82e566834d87686eec3b2
|
7
|
+
data.tar.gz: 93cf6080fba52bffbe3d7fafd4a3ed0121f55accaa8b1c7950e9512a4f409b9031288b51998ab7caff22ac161fd4c0d4c9fb663f369cafb00a42afcfe6ad5732
|
data/app/models/user.rb
CHANGED
@@ -16,6 +16,8 @@ class User < ApplicationRecord
|
|
16
16
|
|
17
17
|
has_many :notifications
|
18
18
|
has_many :assignments, foreign_key: :submitter_id
|
19
|
+
has_many :indicators
|
20
|
+
has_many :user_stats, class_name: 'UserStats'
|
19
21
|
has_many :messages, -> { order(created_at: :desc) }, through: :assignments
|
20
22
|
|
21
23
|
has_many :submitted_exercises, through: :assignments, class_name: 'Exercise', source: :exercise
|
@@ -312,6 +314,18 @@ class User < ApplicationRecord
|
|
312
314
|
UserMailer.certificate(certificate).deliver_later
|
313
315
|
end
|
314
316
|
|
317
|
+
def clear_progress_for!(organization)
|
318
|
+
location = { organization: organization }.compact
|
319
|
+
|
320
|
+
target_assignments = assignments.where(location)
|
321
|
+
|
322
|
+
messages.where(assignment: target_assignments).delete_all
|
323
|
+
|
324
|
+
target_assignments.delete_all
|
325
|
+
indicators.where(location).delete_all
|
326
|
+
user_stats.where(location).delete_all
|
327
|
+
end
|
328
|
+
|
315
329
|
private
|
316
330
|
|
317
331
|
def welcome_to_new_organizations!
|
data/app/models/user_stats.rb
CHANGED
@@ -31,9 +31,9 @@ class UserStats < ApplicationRecord
|
|
31
31
|
private
|
32
32
|
|
33
33
|
def messages_in_discussions_count(date_range = nil)
|
34
|
-
date_filter = {
|
34
|
+
date_filter = { created_at: date_range }.compact
|
35
35
|
result = Message.joins(:discussion)
|
36
|
-
.where({sender: user.uid, discussions: { organization: organization }}.merge(date_filter))
|
36
|
+
.where({sender: user.uid, deletion_motive: nil, discussions: { organization: organization }}.merge(date_filter))
|
37
37
|
.group(:approved)
|
38
38
|
.count
|
39
39
|
unapproved = result[false] || 0
|
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: 9.
|
4
|
+
version: 9.3.0
|
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: 2021-05-
|
11
|
+
date: 2021-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|