media_change
  D   ˆl–Ðz¾”ªC]Šq@=q¦®41hß�þZVq°9 €(ålMÿ?Âƒ^oÁ_�uÐb&=LyZËcõÁÀ ¡    # Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/

require 'rails_helper'

RSpec.describe PermissionSwitchToLabelDescription, db_strategy: :reset, type: :db_migration do
  let(:permission)      { Permission.find_by! name: permission_name }
  let(:permission_name) { 'admin' }

  before do
    ActiveRecord::Migration.rename_column(:permissions, :description, :note)
    ActiveRecord::Migration.remove_column(:permissions, :label)

    Permission.reset_column_information

    permission.preferences[:translations] = ['Sample']
    permission.preferences.delete(:prio)
    permission.save!(validate: false)
  end

  it 'updates attributes' do
    migrate

    expect(permission.reload).to have_attributes(
      label:       'Admin interface',
      description: 'Configure your system.',
      preferences: { prio: 1_000 }
    )
  end

  context 'when permission has additional preferences' do
    let(:permission_name) { 'user_preferences.overview_sorting' }

    it 'keeps additional preferences' do
      migrate

      expect(permission.reload).to have_attributes(
        preferences: { prio: 1690, required: ['ticket.agent'] }
      )
    end
  end
end
  /   ˆ{‹„„-i[D<†ªoZƒ›Ù«Ä669_‘I|¥‰ÓMdœv ©ƒ†ü+=ÄÃ �    ‹      ½•[sš@†ïó+¶{Ñ;Ø”ØéD1j¢h‘˜¤�Ž³r�•ã,«&þú¢˜ÆvbRgÒ\íïwxö }2Mû~Ø»ßÃ›F¯ÛP@èVi"dØFù¡"b	¡–	8ÏÎZ­VâJS6C¶…G”sF.ºÜ…ú‰¶y§Ÿ -ðˆ[Œ@ã”GžÞM\ï¤>@é‚çÔõä§ÉÓˆe´&qL\Äã9Ä	<DòÜã9Ê3–:áf¶,Z1j\j¨Ì[TB»RÚ4u7Hÿ¡Z‘tk†L·E7S¦k< KÑYR‡<Í ®ÑxræÔ!¢Nšäh‘$gÔ‡€D¼t›ƒŸ…ñ`­kÌóëðk³nžêÔM{"/kú…æê=’s§.õ©ç�Jñˆ®'4J�áå£§iò,E…Å}«Nå)¼VÛW•÷-ÄùÆðÂj™¶ÑµJ$î&Åswïòï >$ÌK80(óž²Ç�¿²ØçdšgçO�`×=£³€C ¼¨<Âò"	“t•ì».ˆ¾è·q)Mðd®âùâ1#×K'ŒÔžZ[,Êî§�óÀjQ”F±/nMCýè�}ó¹•±¬
’$È§ «gÕ
 „’¨\(–vµjžº¶!5§Å
fÝ6î�”öÒ³±?]¯,oÜ(6Úo,G†¼‰¸dùL’bŠú±«¥Oæm7´T6æ�*»5çãÎLV«~õÍ÷šêeÅŽïÖã›g,G†¼ÇjQ¤/‹%-Í»E’ïv"‘ù@PI§§CŽÜr�ÉäÚ_N+ÜÛDG†¼…Ÿ
X~uÕð+XþñÐE»ëHCÛ«OCååûgpÀÙß    6   ˆl–Ü4ý( ©¤ýÔâ‚fã ¸ )‹Fÿ�þ^nEœp9e¢€ÏÇƒZÆÂÅÄ ]    # frozen_string_literal: false

require 'bigdecimal'

# require 'bigdecimal/jacobian'
#
# Provides methods to compute the Jacobian matrix of a set of equations at a
# point x. In the methods below:
#
# f is an Object which is used to compute the Jacobian matrix of the equations.
# It must provide the following methods:
#
# f.values(x):: returns the values of all functions at x
#
# f.zero:: returns 0.0
# f.one:: returns 1.0
# f.two:: returns 2.0
# f.ten:: returns 10.0
#
# f.eps:: returns the convergence criterion (epsilon value) used to determine whether two values are considered equal. If |a-b| < epsilon, the two values are considered equal.
#
# x is the point at which to compute the Jacobian.
#
# fx is f.values(x).
#
module Jacobian
  module_function

  # Determines the equality of two numbers by comparing to zero, or using the epsilon value
  def isEqual(a,b,zero=0.0,e=1.0e-8)
    aa = a.abs
    bb = b.abs
    if aa == zero &&  bb == zero then
      true
    else
      if ((a-b)/(aa+bb)).abs < e then
        true
      else
        false
      end
    end
  end


  # Computes the derivative of f[i] at x[i].
  # fx is the value of f at x.
  def dfdxi(f,fx,x,i)
    nRetry = 0
    n = x.size
    xSave = x[i]
    ok = 0
    ratio = f.ten*f.ten*f.ten
    dx = x[i].abs/ratio
    dx = fx[i].abs/ratio if isEqual(dx,f.zero,f.zero,f.eps)
    dx = f.one/f.ten     if isEqual(dx,f.zero,f.zero,f.eps)
    until ok>0 do
      deriv = []
      nRetry += 1
      if nRetry > 100
        raise "Singular Jacobian matrix. No change at x[" + i.to_s + "]"
      end
      dx = dx*f.two
      x[i] += dx
      fxNew = f.values(x)
      for j in 0...n do
        if !isEqual(fxNew[j],fx[j],f.zero,f.eps) then
          ok += 1
          deriv <<= (fxNew[j]-fx[j])/dx
        else
          deriv <<= f.zero
        end
      end
      x[i] = xSave
    end
    deriv
  end

  # Computes the Jacobian of f at x. fx is the value of f at x.
  def jacobian(f,fx,x)
    n = x.size
    dfdx = Array.new(n*n)
   