added 260907 version of worker toolkit

This commit is contained in:
2026-09-08 20:30:51 -04:00
parent cbd3f0f8ca
commit 97aca37663
1283 changed files with 142951 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
module Flaredown
class Colorable
IDS = (0..32).to_a
def self.color_id_for(trackable, user)
parent = Tracking.find_by(user: user, trackable: trackable)
color_id = parent.try(:color_id)
if color_id.blank? && user.present?
used_color_ids = Tracking.where(user_id: user.id).pluck(:color_id)
colors = (0..32).to_a
color_id =
if used_color_ids.count >= colors.count
used_color_ids.count % colors.count
else
(colors - used_color_ids).sample
end
end
color_id
end
end
end