DEV: adds an option to check for working hours (#201)

DEV: adds an option to check for working hours (#201)

diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index ede5320..46aa4a6 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -89,3 +89,5 @@ en:
               label: Hours between assignments
             assigned_topic:
               label: Assigned Topic ID
+            in_working_hours:
+              label: Users in working hours
diff --git a/plugin.rb b/plugin.rb
index 415e0fe..4cae308 100644
--- a/plugin.rb
+++ b/plugin.rb
@@ -665,6 +665,7 @@ after_initialize do
       field :assignees_group, component: :group
       field :assigned_topic, component: :text
       field :minimum_time_between_assignments, component: :text
+      field :in_working_hours, component: :boolean
 
       version 1
 
@@ -732,10 +733,13 @@ after_initialize do
           next
         end
 
-        assign_to_user_id = users_ids.shuffle.find do |user_id|
-          RandomAssignUtils.in_working_hours?(user_id)
+        if fields.dig('in_working_hours', 'value')
+          assign_to_user_id = users_ids.shuffle.find do |user_id|
+            RandomAssignUtils.in_working_hours?(user_id)
+          end
         end
 
+        assign_to_user_id ||= users_ids.sample
         if assign_to_user_id.blank?
           RandomAssignUtils.no_one!(topic_id, group.name)
           next

GitHub sha: 0881b638bd9fb3d4433cea44e4a72fe6d7b9bcd7

This commit appears in #201 which was approved by eviltrout. It was merged by jjaffeux.