ft_42 0.1.4 → 0.1.5
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/ft_42.rb +36 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f45981764a39ac7972d04326bb0ddeb984ad3f4
|
4
|
+
data.tar.gz: f1b7cc5c42dc1842a889e6ae3469af9e1d10c399
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6927c032aa1232969c9423b0a578000cfa6a3837a8841124eed00550cd3ab31cfba5a08fea2fcded62f3abaea6789f93d3ba104abaec25c8248375b381fc7a6b
|
7
|
+
data.tar.gz: 12dca87a67aa6509e4aa36bdd24afb8de7c860e3ebf169e45c2ccdfaef4ee5d4b7e1ea584f0fe06af07ae6fa634d912c51d793b1a869cb1134b956414cb75864
|
data/lib/ft_42.rb
CHANGED
@@ -5,10 +5,12 @@ require "oauth2"
|
|
5
5
|
require "ruby-progressbar"
|
6
6
|
|
7
7
|
module Constants
|
8
|
-
URL_42
|
9
|
-
UID_42
|
10
|
-
SECRET_42
|
11
|
-
HOURS_NEEDED
|
8
|
+
URL_42 = "https://api.intra.42.fr"
|
9
|
+
UID_42 = ENV.fetch("FT42_UID")
|
10
|
+
SECRET_42 = ENV.fetch("FT42_SECRET")
|
11
|
+
HOURS_NEEDED = 38
|
12
|
+
HOURS_ACHIEVEMENT = 90
|
13
|
+
HOURS_CHALLENGE = 100
|
12
14
|
end
|
13
15
|
|
14
16
|
|
@@ -217,7 +219,7 @@ class UserPrinter
|
|
217
219
|
|
218
220
|
def correction_points
|
219
221
|
print "Has #{highlight(ActionView::Base.new.pluralize(user.correction_points, 'correction point'))}."
|
220
|
-
grabs_pitchfork if user.correction_points >
|
222
|
+
grabs_pitchfork if user.correction_points > 8
|
221
223
|
puts
|
222
224
|
end
|
223
225
|
|
@@ -279,16 +281,42 @@ class UserSessionsPrinter
|
|
279
281
|
end
|
280
282
|
|
281
283
|
def hours_this_week
|
282
|
-
puts "Has " + highlight("#{hours} #{hours_pluralize}") + " in the clusters this week, starting #{last_monday}.
|
284
|
+
puts "Has " + highlight("#{hours} #{hours_pluralize}") + " in the clusters this week, starting #{last_monday}."
|
283
285
|
hours_progress_bar
|
286
|
+
hours_progress_bar_achievement
|
287
|
+
hours_progress_bar_challenge
|
284
288
|
end
|
285
289
|
|
286
290
|
def hours_progress_bar
|
287
291
|
percent_complete = ((hours.to_f / HOURS_NEEDED.to_f) * 100).round
|
288
292
|
if (percent_complete <= 100)
|
289
|
-
progressbar_needed = ProgressBar.create(progress_mark: "█", length:
|
293
|
+
progressbar_needed = ProgressBar.create(progress_mark: "█", length: 64, format: "%t: |" + warning("%B") + "| #{hours}/38 hours")
|
290
294
|
percent_complete.times { progressbar_needed.increment }
|
291
|
-
|
295
|
+
print "Minimum "
|
296
|
+
print progressbar_needed
|
297
|
+
puts
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
def hours_progress_bar_achievement
|
302
|
+
percent_complete = ((hours.to_f / HOURS_ACHIEVEMENT.to_f) * 100).round
|
303
|
+
if (percent_complete <= 100)
|
304
|
+
progressbar_needed = ProgressBar.create(progress_mark: "█", length: 60, format: "%t: |" + warning("%B") + "| #{hours}/90 hours")
|
305
|
+
percent_complete.times { progressbar_needed.increment }
|
306
|
+
print "Achievement "
|
307
|
+
print progressbar_needed
|
308
|
+
puts
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
def hours_progress_bar_challenge
|
313
|
+
percent_complete = ((hours.to_f / HOURS_CHALLENGE.to_f) * 100).round
|
314
|
+
if (percent_complete <= 100)
|
315
|
+
progressbar_needed = ProgressBar.create(progress_mark: "█", length: 63, format: "%t: |" + warning("%B") + "| #{hours}/100 hours")
|
316
|
+
percent_complete.times { progressbar_needed.increment }
|
317
|
+
print "Challenge "
|
318
|
+
print progressbar_needed
|
319
|
+
puts
|
292
320
|
end
|
293
321
|
end
|
294
322
|
|