Merge pull request #606 from AyuntamientoMadrid/proposal-code

uses the month (%m) instead of the minute (%M) in the proposal code
This commit is contained in:
Juanjo Bazán
2015-10-14 12:49:37 +02:00
2 changed files with 2 additions and 2 deletions

View File

@@ -65,7 +65,7 @@ class Proposal < ActiveRecord::Base
end
def code
"#{Setting.value_for("proposal_code_prefix")}-#{created_at.strftime('%Y-%M')}-#{id}"
"#{Setting.value_for("proposal_code_prefix")}-#{created_at.strftime('%Y-%m')}-#{id}"
end
def after_commented

View File

@@ -125,7 +125,7 @@ describe Proposal do
it "should have a code" do
Setting.find_by(key: "proposal_code_prefix").update(value: "TEST")
proposal = create(:proposal)
expect(proposal.code).to eq "TEST-#{proposal.created_at.strftime('%Y-%M')}-#{proposal.id}"
expect(proposal.code).to eq "TEST-#{proposal.created_at.strftime('%Y-%m')}-#{proposal.id}"
end
describe "#editable?" do