Below is an example schema of a customer support software. We want to implement round robin assignment algorithm in Ruby. Provide a quick implementation.


  create_table "conversations", force: :cascade do |t|
    t.uuid "uuid", default: -> { "uuid_generate_v4()" }, null: false
    t.string "source_id", null: false
    t.integer "source_type", null: false
    t.jsonb "source_data"
    t.bigint "source_created_at", null: false
    t.bigint "source_modified_at"
    t.integer "channel_type", null: false
    t.integer "channel_subtype", null: false
    t.datetime "terminated_at"
    t.datetime "first_inbound_message_at"
    t.datetime "first_outbound_message_at"
    t.datetime "last_inbound_message_at"
    t.datetime "last_outbound_message_at"
    t.datetime "discarded_at"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.bigint "channel_id"
    t.bigint "app_id"
    t.bigint "account_id"
    t.datetime "last_message_at"
    t.integer "state", default: 1, null: false
    t.datetime "last_opened_at"
    t.datetime "last_closed_at"
    t.bigint "assignee_id"
    t.datetime "assignment_changed_at"
    t.integer "snoozed_until"
    t.hstore "pinned_messages"
    t.bigint "assigned_team_id"
    t.index "account_id, app_id, channel_id, source_id, ((terminated_at IS NULL))", name: "index_p_conversations_2", unique: true, where: "(terminated_at IS NULL)"
    t.index ["account_id", "app_id", "channel_id", "source_id", "terminated_at", "discarded_at"], name:  Please answer in JSON format.
user