DEV: adds an option to check for working hours (#201)
This commit is contained in:
		
							parent
							
								
									cfc25d9ac2
								
							
						
					
					
						commit
						0881b638bd
					
				|  | @ -89,3 +89,5 @@ en: | ||||||
|               label: Hours between assignments |               label: Hours between assignments | ||||||
|             assigned_topic: |             assigned_topic: | ||||||
|               label: Assigned Topic ID |               label: Assigned Topic ID | ||||||
|  |             in_working_hours: | ||||||
|  |               label: Users in working hours | ||||||
|  |  | ||||||
|  | @ -665,6 +665,7 @@ after_initialize do | ||||||
|       field :assignees_group, component: :group |       field :assignees_group, component: :group | ||||||
|       field :assigned_topic, component: :text |       field :assigned_topic, component: :text | ||||||
|       field :minimum_time_between_assignments, component: :text |       field :minimum_time_between_assignments, component: :text | ||||||
|  |       field :in_working_hours, component: :boolean | ||||||
| 
 | 
 | ||||||
|       version 1 |       version 1 | ||||||
| 
 | 
 | ||||||
|  | @ -732,10 +733,13 @@ after_initialize do | ||||||
|           next |           next | ||||||
|         end |         end | ||||||
| 
 | 
 | ||||||
|  |         if fields.dig('in_working_hours', 'value') | ||||||
|           assign_to_user_id = users_ids.shuffle.find do |user_id| |           assign_to_user_id = users_ids.shuffle.find do |user_id| | ||||||
|             RandomAssignUtils.in_working_hours?(user_id) |             RandomAssignUtils.in_working_hours?(user_id) | ||||||
|           end |           end | ||||||
|  |         end | ||||||
| 
 | 
 | ||||||
|  |         assign_to_user_id ||= users_ids.sample | ||||||
|         if assign_to_user_id.blank? |         if assign_to_user_id.blank? | ||||||
|           RandomAssignUtils.no_one!(topic_id, group.name) |           RandomAssignUtils.no_one!(topic_id, group.name) | ||||||
|           next |           next | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue