From 72b6126f30fd397739a7e1b9df3fb3fa5ad90c0f Mon Sep 17 00:00:00 2001 From: kikito Date: Wed, 14 Oct 2015 12:40:26 +0200 Subject: [PATCH 1/2] uses the month (%m) instead of the minute (%M) in the proposal code --- app/models/proposal.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/proposal.rb b/app/models/proposal.rb index b14d2e194..f7c1c5078 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -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 From 4783d28bf4a9db5069b7d6a19b4e26c1e8c05d79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Wed, 14 Oct 2015 12:49:18 +0200 Subject: [PATCH 2/2] fix test --- spec/models/proposal_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb index ac7c1edfb..6e5acb379 100644 --- a/spec/models/proposal_spec.rb +++ b/spec/models/proposal_spec.rb @@ -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