[Git][noosfero/noosfero][master] 2 commits: Applying SOLID techniques
Rodrigo Souto
gitlab at mg.gitlab.com
Tue Jul 25 11:18:28 BRT 2017
Rodrigo Souto pushed to branch master at Noosfero / noosfero
Commits:
ab8542ad by antoniocoj at 2017-07-25T14:18:03+00:00
Applying SOLID techniques
- - - - -
975f46bb by Rodrigo Souto at 2017-07-25T14:18:04+00:00
Merge branch 'solid' into 'master'
Applying SOLID techniques
See merge request !1273
- - - - -
1 changed file:
- app/models/concerns/code_numbering.rb
Changes:
=====================================
app/models/concerns/code_numbering.rb
=====================================
--- a/app/models/concerns/code_numbering.rb
+++ b/app/models/concerns/code_numbering.rb
@@ -35,14 +35,24 @@ module CodeNumbering
self.code_scope.maximum(self.code_numbering_field) || 0
end
+ def code_max
+ max = nil
+
+ if self.code_numbering_options[:start]
+ max = self.code_numbering_options[:start].to_i - 1
+ end
+
+ max
+ end
+
def create_code_numbering
- max = self.code_numbering_options[:start].to_i - 1 if self.code_numbering_options[:start]
+ max = code_max
max = self.code_maximum
self.send "#{self.code_numbering_field}=", max+1
end
def reset_scope_code_numbering
- max = self.code_numbering_options[:start].to_i - 1 if self.code_numbering_options[:start]
+ max = code_max
max ||= 1
self.code_scope.order(:created_at).each do |record|
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/82337b585b9d472ec3faa3d67a22629c7fdffdf4...975f46bb947732610c42c0f08714f5c25215e163
---
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/82337b585b9d472ec3faa3d67a22629c7fdffdf4...975f46bb947732610c42c0f08714f5c25215e163
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20170725/efb24248/attachment-0001.html>
More information about the Noosfero-dev
mailing list