Browse Source

Fix issue preventing 'none_present'-messages

Cause: empty list is still truthy, should check .count
Maarten van den Berg 7 years ago
parent
commit
c359326611
1 changed files with 3 additions and 3 deletions
  1. 3 3
      app/controllers/api/activities_controller.rb

+ 3 - 3
app/controllers/api/activities_controller.rb

@@ -40,19 +40,19 @@ class Api::ActivitiesController < ApiController
40 40
     absentnames = absent
41 41
       .map{|p| p.person.first_name }
42 42
 
43
-    if presentnames
43
+    if presentnames.count > 0
44 44
       present_mess = I18n.t('activities.participant.these_present', count: present.count, names: presentnames.join(', '))
45 45
     else
46 46
       present_mess = I18n.t('activities.participant.none_present')
47 47
     end
48 48
 
49
-    if unknownnames
49
+    if unknownnames.count > 0
50 50
       unknown_mess = I18n.t('activities.participant.these_unknown', count: unknown.count, names: unknownnames.join(', '))
51 51
     else
52 52
       unknown_mess = I18n.t('activities.participant.none_unknown')
53 53
     end
54 54
 
55
-    if absentnames
55
+    if absentnames.count > 0
56 56
       absent_mess = I18n.t('activities.participant.these_absent', count: absent.count, names: absentnames.join(', '))
57 57
     else
58 58
       absent_mess = I18n.t('activities.participant.none_absent')