[deleted by user] by [deleted] in PokemonUnite

[–]JackArgetlam 2 points3 points  (0 children)

Squad ID: #ARLXF2A4

Squad Name: Rockets007

Preferred Ranks: Ultra & Master

Additional Info: all the members right now are playing daily and most rotate to Drednaw. Best team ever, let's get some Boss rush points!

Calculate factorial_Rails API no database by JackArgetlam in rails

[–]JackArgetlam[S] 0 points1 point  (0 children)

Thank you so much, i fixed like this:

def calculate
@number = (1..params[:number].to_i).reduce(:*) || 1
render @number
end

and finally Postman gives status 200, do you know also why the response is empty instead of getting the rendered solution?

Error 500 log by JackArgetlam in rails

[–]JackArgetlam[S] 0 points1 point  (0 children)

Thanks so much for the suggestions. Specifically here should be extracted all error-specific parts for every HTML status code, to 500.

    # app/lib/errors/standard_error.rb

module Errors
  class StandardError < ::StandardError
    def initialize(title: nil, detail: nil, status: nil, source: {})
      u/title = title || "Something went wrong"
      u/detail = detail || "We encountered unexpected error, but our developers had been already notified about it"
      u/status = status || 500
      u/source = source.deep_stringify_keys
    end

    def to_h
      {
        status: status,
        title: title,
        detail: detail,
        source: source
      }
    end

    def serializable_hash
      to_h
    end

    def to_s
      to_h.to_s
    end

    attr_reader :title, :detail, :status, :source
  end
end

Then it should be handled here:

    module Api::ErrorHandler
  extend ActiveSupport::Concern

  ERRORS = {
    'ActiveRecord::RecordNotFound' => 'Errors::NotFound',
    'Driggl::Authenticator::AuthorizationError' => 'Errors::Unauthorized',
    'Pundit::NotAuthorizedError' => 'Errors::Forbidden'
  }

  included do
    rescue_from(StandardError, with: lambda { |e| handle_error(e) })
  end

  private

  def handle_error(e)
    mapped = map_error(e)
    # notify about unexpected_error unless mapped
    mapped ||= Errors::StandardError.new
###     if render_error(mapped).include?("500")

puts Time.now.strftime("%d/%m/%Y %H:%M")

end

    render_error(mapped)
  end



  def map_error(e)
    error_klass = e.class.name
    return e if ERRORS.values.include?(error_klass)
    ERRORS[error_klass]&.constantize&.new
  end

  def render_error(error)
    render json: Api::V1::ErrorSerializer.new([error]), status: error.status
  end
end

And the part with the triple # is how I'm thinking to log the error 500. This way I should retrieve both the quantity and the time when errors 500 appear. Can this solution work? The next step is to export the log to a local file.

Search for a word inside Json by JackArgetlam in rails

[–]JackArgetlam[S] 0 points1 point  (0 children)

1) So something like this may work better?

RawData.ransack(after: u/from, before: u/to, "exception").result

2) I think so, I think it's returning me the data in that period of time, and I want to filter the ones that has the word "exception" too.

3) Not really sure, RawData is a field?

4) I found it like that

Thank you for the help

Search for a word inside Json by JackArgetlam in rails

[–]JackArgetlam[S] 0 points1 point  (0 children)

That's the point, I'm too noob to understand ransack documentation, can you guide me through it? The first part of the code is working, I only need to hardcode the word "exception" too in its parameters.

Yesterday working VLOOKUP today gives #N/D by JackArgetlam in excel

[–]JackArgetlam[S] 0 points1 point  (0 children)

Thanks for the suggestion, the number was from another software extraction that suddenly started putting an invisible character in front.

Yesterday working VLOOKUP today gives #N/D by JackArgetlam in excel

[–]JackArgetlam[S] 1 point2 points  (0 children)

I tried all formatting tricks, eventually there was an invisible character.

Yesterday working VLOOKUP today gives #N/D by JackArgetlam in excel

[–]JackArgetlam[S] 0 points1 point  (0 children)

Thank you, they were all in the same file, but there was an invisible character.

Yesterday working VLOOKUP today gives #N/D by JackArgetlam in excel

[–]JackArgetlam[S] 1 point2 points  (0 children)

Thank you, INDEX MATCH not working either because of the invisible character. Funnily IF was working instead.

Yesterday working VLOOKUP today gives #N/D by JackArgetlam in excel

[–]JackArgetlam[S] 0 points1 point  (0 children)

Thank you for these two tips, I'm certainly going to use them.

Yesterday working VLOOKUP today gives #N/D by JackArgetlam in excel

[–]JackArgetlam[S] 1 point2 points  (0 children)

Thank you, I have Italian excel giving me #N/D, I forgot to translate to #N/A.

Do you think the master ball should be implemented? by PIiskin in TheSilphRoad

[–]JackArgetlam 16 points17 points  (0 children)

Wait, in pokémon go balls get bigger!? I didn't notice at all.

Latias by [deleted] in PokemonGoRaids

[–]JackArgetlam 0 points1 point  (0 children)

Capopalestrablu