ucf_messages 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ucf_messages.rb +9 -19
- 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: 972109932f7f6c84c50ad3b7563ae2c32770d556a803682cc6674459f5f1a631
|
4
|
+
data.tar.gz: 07dde047f1bce4fd9238636d4c7269f31a0138348491a8d69325a2028198ce71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c243542b3060c671a107401cb6b3d88b27fd8123ac74721c978793972f168900a111c6341f4fe0d54a7bbb8706708b8d2dab70a8df5e0a79743aabd690cd1d7b
|
7
|
+
data.tar.gz: 6da590ef28408c433e10a6d2e8833db053e4b9e1c48a7da7fa090139f88103d34d0083eae0eed621a12a39ed48993d21e00af8c2853d2d5f6339b338ab418251
|
data/lib/ucf_messages.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'activesupport_extensions'
|
4
|
+
|
3
5
|
class UcfMessages
|
4
6
|
MAX_REWARD_THRESHOLD = 5000
|
5
7
|
|
@@ -13,7 +15,7 @@ class UcfMessages
|
|
13
15
|
|
14
16
|
private
|
15
17
|
|
16
|
-
# TODO: check this calculation! Why
|
18
|
+
# TODO: check this calculation! Why are there two rewards?
|
17
19
|
def streak_size
|
18
20
|
@protocol&.rewards&.second&.threshold || 3
|
19
21
|
end
|
@@ -30,6 +32,7 @@ class UcfMessages
|
|
30
32
|
sms_pool += streak_conditions if sms_pool.empty?
|
31
33
|
sms_pool += default_pool if sms_pool.empty?
|
32
34
|
|
35
|
+
# Sample returns a random entry from the array
|
33
36
|
sms_pool.sample
|
34
37
|
end
|
35
38
|
# rubocop:enable Metrics/PerceivedComplexity
|
@@ -42,7 +45,8 @@ class UcfMessages
|
|
42
45
|
sms_pool = []
|
43
46
|
1000.step(MAX_REWARD_THRESHOLD, 1000) do |threshold|
|
44
47
|
# 1000 = 10 euro
|
45
|
-
sms_pool
|
48
|
+
# override the current sms_pool so we only get the message for the highest threshold reached
|
49
|
+
sms_pool = rewards_threshold_pool(threshold) if rewards_before < threshold && rewards_after >= threshold
|
46
50
|
end
|
47
51
|
sms_pool
|
48
52
|
end
|
@@ -109,8 +113,8 @@ class UcfMessages
|
|
109
113
|
def first_invitation_pool
|
110
114
|
[
|
111
115
|
'Welkom bij het u-can-feel dagboekonderzoek! Doe je ook mee? We vragen je om elke week in een paar ' \
|
112
|
-
'minuten wat vragen te beantwoorden over hoe het met je gaat. Daarmee help
|
113
|
-
'én kun je geld verdienen. Via de link kun
|
116
|
+
'minuten wat vragen te beantwoorden over hoe het met je gaat. Daarmee help je ons met ons onderzoek ' \
|
117
|
+
'én kun je geld verdienen. Via de link kun je meer informatie krijgen en de eerste vragenlijst ' \
|
114
118
|
'invullen.'
|
115
119
|
]
|
116
120
|
end
|
@@ -120,7 +124,7 @@ class UcfMessages
|
|
120
124
|
'Hoi {{deze_student}}! Er staat een vragenlijst voor je klaar, vul je hem weer in? :D',
|
121
125
|
'Een u-can-feel tip: vul drie weken achter elkaar een vragenlijst in en verdien een bonus voor elke ' \
|
122
126
|
'vragenlijst!',
|
123
|
-
'Hoi {{deze_student}}! Vul direct de
|
127
|
+
'Hoi {{deze_student}}! Vul direct de volgende vragenlijst in. Het kost je maar een paar minuten en je helpt ' \
|
124
128
|
'ons enorm!',
|
125
129
|
'Hallo {{deze_student}}, verdien een euro! Vul nu de vragenlijst in!',
|
126
130
|
'Fijn dat jij meedoet! Door jou kunnen leerlingen met wie het niet zo goed gaat nog betere begeleiding ' \
|
@@ -215,10 +219,6 @@ class UcfMessages
|
|
215
219
|
@curidx.zero?
|
216
220
|
end
|
217
221
|
|
218
|
-
def completed_some?
|
219
|
-
@protocol_completion.pluck(:completed).any?
|
220
|
-
end
|
221
|
-
|
222
222
|
def missed_previous_response?
|
223
223
|
# Minimal pattern: .C (X = completed, C = current)
|
224
224
|
# index: 01
|
@@ -243,16 +243,6 @@ class UcfMessages
|
|
243
243
|
@protocol_completion[@curidx - 2][:streak] >= streak_size
|
244
244
|
end
|
245
245
|
|
246
|
-
# missed more than one in a row (but not all) prior to the current response
|
247
|
-
def missed_more_than_one?
|
248
|
-
# Minimal pattern: X..C (X = completed, C = current)
|
249
|
-
# index: 0123
|
250
|
-
@curidx > 2 &&
|
251
|
-
!@protocol_completion[@curidx - 1][:completed] &&
|
252
|
-
!@protocol_completion[@curidx - 2][:completed] &&
|
253
|
-
@protocol_completion[0..(@curidx - 3)].pluck(:completed).any?
|
254
|
-
end
|
255
|
-
|
256
246
|
def missed_everything?
|
257
247
|
# Minimal pattern: .C (X = completed, C = current)
|
258
248
|
# index: 01
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ucf_messages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ando Emerencia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: library for determining which invitation text to use
|
14
14
|
email: info@compsy.ch
|