Projects STRLCPY Hunt3r Commits ce875375
🤬
  • ■ ■ ■ ■ ■ ■
    backend/app/controllers/admin/platformstats_controller.rb
    skipped 29 lines
    30 30   
    31 31   render status: 200, json: { message: I18n.t('success.controllers.admin.platformstats.updated'), data: nil }
    32 32   end
    33  -end
    34 33   
    35  -private
     34 + private
    36 35   
    37  -def set_platform
    38  - return @platform if @platform
     36 + def set_platform
     37 + return @platform if @platform
    39 38   
    40  - @platform = Platform.find_by(name: params[:name])
    41  - if @platform.nil?
    42  - return render status: 422, json: { message: I18n.t('errors.controllers.admin.platforms.unknown'), data: nil }
    43  - end
     39 + @platform = Platform.find_by(name: params[:name])
     40 + if @platform.nil?
     41 + return render status: 422, json: { message: I18n.t('errors.controllers.admin.platforms.unknown'), data: nil }
     42 + end
    44 43   
    45  - @platform
    46  -end
     44 + @platform
     45 + end
    47 46   
    48  -def query_params
    49  - query_params = { from: params[:from], to: params[:to] }
     47 + def query_params
     48 + query_params = { from: params[:from], to: params[:to] }
    50 49   
    51  - query_params[:from] && query_params[:to] ? query_params : { from: '2014-01-01', to: '2030-12-31' }
     50 + query_params[:from] && query_params[:to] ? query_params : { from: '2014-01-01', to: '2030-12-31' }
     51 + end
    52 52  end
    53 53   
  • ■ ■ ■ ■ ■ ■
    backend/app/controllers/programs_controller.rb
    skipped 26 lines
    27 27   render status: 429, json: { message: I18n.t('errors.controllers.programs.rate_limited'), data: rate_limited }
    28 28   end
    29 29   end
    30  -end
    31 30   
    32  -private
     31 + private
    33 32   
    34  -def launch_sync(platforms)
    35  - rate_limited = []
    36  - platforms.each do |platform|
    37  - rate_limited << rate_limited?(platform)
    38  - next if rate_limited.include?(platform.name)
     33 + def launch_sync(platforms)
     34 + rate_limited = []
     35 + platforms.each do |platform|
     36 + rate_limited << rate_limited?(platform)
     37 + next if rate_limited.include?(platform.name)
    39 38   
    40  - update_programs(platform)
    41  - platform.programs.last.update(updated_at: Time.now) if platform.programs.last
    42  - end
     39 + update_programs(platform)
     40 + platform.programs.last.update(updated_at: Time.now) if platform.programs.last
     41 + end
    43 42   
    44  - rate_limited
    45  -end
     43 + rate_limited
     44 + end
    46 45   
    47  -# In order to avoid that several refreshes are launched at the same time so as not to overload the platform's API
    48  -def rate_limited?(platform)
    49  - return unless platform.programs.last && Time.now - platform.programs.last.updated_at < 1800
     46 + # In order to avoid that several refreshes are launched at the same time so as not to overload the platform's API
     47 + def rate_limited?(platform)
     48 + return unless platform.programs.last && Time.now - platform.programs.last.updated_at < 1800
    50 49   
    51  - platform.name
    52  -end
     50 + platform.name
     51 + end
    53 52   
    54  -def query_params
    55  - params[:program] || ''
     53 + def query_params
     54 + params[:program] || ''
     55 + end
    56 56  end
    57 57   
Please wait...
Page is in error, reload to recover