-
Notifications
You must be signed in to change notification settings - Fork 5
Ticket_id #52283 - Alinhamento com o Fork da Hotsoft #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
64afab2
2bd352f
ba6536e
97ef69d
da6cbe3
7744702
c822c9c
548ed45
e64f583
f4c23a1
a5ff925
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -173,7 +173,7 @@ def apply_ac_filter(parsed_filter, system_params) | |
| if filter_def.has_sql_query? | ||
| sql_to_execute = ActiveRecord::Base.send(:sanitize_sql_array, conditions) | ||
| r = [] | ||
| ActiveRecord::Base.connection.instance_exec(sql_to_execute).each(:as => :hash) {|i| r << i} | ||
| ActiveRecord::Base.connection.instance_exec(sql_to_execute).each(as :hash) {|i| r << i} | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alteração sem relação direta com o commit portada do nosso fork.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. O que faz esta alteração?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Só troca de sintaxe mesmo. Posso remover esta alteração. |
||
| else | ||
| find_params[:select] = filter_def.select_sql.to_s unless filter_def.select_sql.nil? | ||
| find_params[:order] = filter_def.order_sql.to_s unless filter_def.order_sql.nil? | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| class AddExcluirToReportTemplate < ActiveRecord::Migration | ||
| def self.up | ||
| add_column :report_templates, :excluir, :boolean | ||
| end | ||
|
|
||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Migration relativa a coluna que agora controla a exclusão. |
||
| def self.down | ||
| remove_column :report_templates, :excluir | ||
| end | ||
| end | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| require 'yaml' | ||
|
|
||
|
|
||
| ReportTemplate.delete_all | ||
| ReportTemplate.update_all({:ac_filter_def_id => nil, :excluir => true}) | ||
| AcFilterOption.delete_all | ||
| AcFilter.delete_all | ||
| AcFilterDef.delete_all | ||
|
|
@@ -20,14 +20,30 @@ | |
| Dir.glob("#{Rails.root}/db/reports/*.yml").each do |f| | ||
| puts "Parsing file: #{f}" | ||
| params = YAML::load(File.open(f, 'r')) | ||
| if params["filter_name"] | ||
| f = AcFilterDef.find_by_name(params.delete("filter_name")) | ||
| if f | ||
| params["ac_filter_def_id"] = f.id | ||
| r = ReportTemplate.find_by_name(params["name"]) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ajustes para o novo comportamento relativo a "exclusão".
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Favor detalhar esta lógica de exclusão. O que ela resolve? Por que foi implementada?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alterado para atualizar ao invés de excluir. Para não perder relação entre os relatórios e os laboratórios. Só exibir relatórios para laboratórios específicos.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Como se trata de uma implementação específica para o seu projeto peço que realize em classes fora do contexto da biblioteca, no seu projeto por exemplo. Ou então que insira este comportamento porém de forma configurável e mantendo o padrão como era anteriormente. |
||
| if r.nil? | ||
| if params["filter_name"] | ||
| f = AcFilterDef.find_by_name(params.delete("filter_name")) | ||
| if f | ||
| params["ac_filter_def_id"] = f.id | ||
| end | ||
| end | ||
| params["excluir"] = false | ||
| ReportTemplate.create(params) | ||
| puts "Criado relatório: " + params["name"] | ||
| else | ||
| if params["filter_name"] | ||
| f = AcFilterDef.find_by_name(params.delete("filter_name")) | ||
| if f | ||
| params["ac_filter_def_id"] = f.id | ||
| end | ||
| end | ||
| params["excluir"] = false | ||
| r.update_attributes(params) | ||
| puts "Atualizado relatório: " + params["name"] | ||
| end | ||
| end | ||
| ReportTemplate.create(params) | ||
| puts "Criado relatório: " + params["name"] | ||
| end | ||
| puts "FIM" | ||
| ReportTemplate.destroy_all(:excluir => true) | ||
| puts "finishing, closing, and going home" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -159,6 +159,7 @@ def second_pass | |
| def run_totals(data_row) | ||
| @running_totals.each do |rt| | ||
| vl = get_raw_field_value(data_row, rt) | ||
| vl = (vl.is_a? (String) ? vl.to_f : vl) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gerava problemas com alguns tipos de dados do Mysql. Este ajuste evitou muitos problemas com médias e suas totalizações. |
||
| @totals[rt] = (@totals[rt] || 0) + (vl == '' ? 0 : vl) | ||
| @group_totals[rt] = (@group_totals[rt] || 0) + (vl == '' ? 0 : vl) | ||
| end | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,7 +53,7 @@ def line_break(size = TEXT_SIZE) | |
| def format(value, formatter, options = {}) | ||
| if !value.nil? && value != '' | ||
| if (formatter == :currency) | ||
| value = value.round(2) | ||
| value = value.round(2) rescue sprintf('%.2f', value).to_f | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gera problema com versões do framework mais antigas como no nossa caso. |
||
| if value < 0 | ||
| '-'+((value.to_i*-1).to_s.reverse.gsub(/...(?=.)/,'\&.').reverse) + ',' + ('%02d' % ((value.abs * 100).round % 100)) | ||
| else | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| Gem::Specification.new do |s| | ||
| s.name = %q{prawn_report} | ||
| s.version = "1.9.17" | ||
| s.date = %q{2015-09-14} | ||
| s.authors = ["Ricardo Acras" "Egon Hilgenstieler" "Juliano Andrade" "Vinicius Cubas Brand"] | ||
| s.email = %q{ricardo@acras.com.br julianoch@gmail.com egon@acras.com.br viniciuscb@gmail.com} | ||
| s.version = "1.9.21" | ||
| s.date = %q{2016-11-23} | ||
| s.authors = ["Ricardo Acras", "Egon Hilgenstieler", "Juliano Andrade", "Vinicius Cubas Brand", "Wellington Torrejais da Silva"] | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Array de emails não estava separado por "," Agora segue conforme a documentação. |
||
| s.email = 'ricardo@acras.com.br' | ||
| s.email = %q{ricardo@acras.com.br julianoch@gmail.com egon@acras.com.br viniciuscb@gmail.com wtds.trabalho@gmail.com desenv2@labplus.com.br} | ||
| s.summary = %q{Prawn Report makes it easy to create PDF reports.} | ||
| s.homepage = %q{http://www.acras.com.br/} | ||
| s.description = %q{Prawn report is a class repository wich uses prawn gem capabilities to generate PDF documents in order to make it easy to create real life reports.} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ | |
| module PrawnReport | ||
| class Listing < Report | ||
|
|
||
| #alias :super_new_page :new_page | ||
| alias :super_new_page :new_page | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Supre uso do super_new_page em alguns relatórios.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Não entendi o objetivo desta alteração.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Segue o Ticket: http://192.168.200.44:3000/issues/22060
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. É utilizado em alguns de nossos relatórios. |
||
|
|
||
| def initialize(report_params = {}) | ||
| super(report_params) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tratamento em relação a nulidade do valor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aqui você está abafando uma exceção. Isto não é uma boa prática pois apesar de resolver algum caso específico que você precisou resolver poderá abafar exceções que deveriam aparecer para o programador. Isto pode atrapalhar em debugs.
Poderia alterar e somente abafar nos casos em que necessita?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O commit original somente descreve: tratamento de valor nulo.
Se desejar posso remover esta alteração e testar um por um dos relatórios.
No na época(2013) não foi documentado não sei se a alteração
pode tratar situação específicas ou influenciadas pela combinação de filtros.
Se eu remover apesar dos testes locais ainda haverá a possibilidade do erro ocorrer no cliente. Neste caso seria interessante manter esta alteração?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Como boa prática peço que remova a alteração. Se for necessário de fato o ideal é criar em seu projeto uma subclasse desta classe que faça isto e a use somente no seu projeto. Como se trata de uma biblioteca usada em vários projetos não temos como aceitar esta mudança na classe comum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum. Entendi.
Neste caso irei refatorar e em breve subo as alterações.
No entanto devido a rotina interna irei alinhar um prazo.
Não conseguirei fazer neste momento.
Portanto o pull request vai demorar um tempo para ser realizado novamente.