Commit bf29e33d authored by Douwe Maan's avatar Douwe Maan

Rename issued_at to starts_at.

parent fda2b5ad
...@@ -219,7 +219,7 @@ GEM ...@@ -219,7 +219,7 @@ GEM
diff-lcs (~> 1.1) diff-lcs (~> 1.1)
mime-types (~> 1.15) mime-types (~> 1.15)
posix-spawn (~> 0.3) posix-spawn (~> 0.3)
gitlab-license (0.0.2) gitlab-license (0.0.3)
gitlab-linguist (3.0.1) gitlab-linguist (3.0.1)
charlock_holmes (~> 0.6.6) charlock_holmes (~> 0.6.6)
escape_utils (~> 0.2.4) escape_utils (~> 0.2.4)
......
...@@ -97,7 +97,7 @@ class License < ActiveRecord::Base ...@@ -97,7 +97,7 @@ class License < ActiveRecord::Base
restricted_user_count = self.restrictions[:active_user_count] restricted_user_count = self.restrictions[:active_user_count]
date_range = (self.issued_at - 1.year)..self.issued_at date_range = (self.starts_at - 1.year)..self.starts_at
active_user_count = HistoricalData.during(date_range).maximum(:active_user_count) || 0 active_user_count = HistoricalData.during(date_range).maximum(:active_user_count) || 0
return unless active_user_count return unless active_user_count
...@@ -107,7 +107,7 @@ class License < ActiveRecord::Base ...@@ -107,7 +107,7 @@ class License < ActiveRecord::Base
overage = active_user_count - restricted_user_count overage = active_user_count - restricted_user_count
message = "" message = ""
message << "During the year before this license was issued, this GitLab installation had " message << "During the year before this license started, this GitLab installation had "
message << "#{number_with_delimiter active_user_count} active #{"user".pluralize(active_user_count)}, " message << "#{number_with_delimiter active_user_count} active #{"user".pluralize(active_user_count)}, "
message << "exceeding this license's limit of #{number_with_delimiter restricted_user_count} by " message << "exceeding this license's limit of #{number_with_delimiter restricted_user_count} by "
message << "#{number_with_delimiter overage} #{"user".pluralize(overage)}. " message << "#{number_with_delimiter overage} #{"user".pluralize(overage)}. "
......
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
.panel-heading .panel-heading
Details Details
%ul.well-list %ul.well-list
%li
%span.light Issued:
%strong= time_ago_with_tooltip @license.issued_at
%li %li
%span.light Uploaded: %span.light Uploaded:
%strong= time_ago_with_tooltip @license.created_at %strong= time_ago_with_tooltip @license.created_at
%li
%span.light Started:
%strong= time_ago_with_tooltip @license.starts_at
%li %li
%span.light %span.light
- if @license.expired? - if @license.expired?
...@@ -107,8 +107,8 @@ ...@@ -107,8 +107,8 @@
%tr %tr
- @license.licensee.keys.each do |label| - @license.licensee.keys.each do |label|
%th= label %th= label
%th Issued at
%th Uploaded at %th Uploaded at
%th Started at
%th Expired at %th Expired at
%th Active users %th Active users
%tbody %tbody
...@@ -118,10 +118,10 @@ ...@@ -118,10 +118,10 @@
%td= license.licensee[label] %td= license.licensee[label]
%td %td
%span %span
= license.issued_at = license.created_at
%td %td
%span %span
= license.created_at = license.starts_at
%td %td
%span %span
= license.expires_at || "Never" = license.expires_at || "Never"
......
...@@ -211,7 +211,7 @@ FactoryGirl.define do ...@@ -211,7 +211,7 @@ FactoryGirl.define do
end end
factory :gitlab_license, class: "Gitlab::License" do factory :gitlab_license, class: "Gitlab::License" do
issued_at { Date.today - 1.month } starts_at { Date.today - 1.month }
licensee do licensee do
{ "Name" => Faker::Name.name } { "Name" => Faker::Name.name }
end end
......
...@@ -25,7 +25,7 @@ describe License do ...@@ -25,7 +25,7 @@ describe License do
describe "Historical active user count" do describe "Historical active user count" do
let(:active_user_count) { User.active.count + 10 } let(:active_user_count) { User.active.count + 10 }
let(:date) { License.current.issued_at } let(:date) { License.current.starts_at }
let!(:historical_data) { HistoricalData.create!(date: date, active_user_count: active_user_count) } let!(:historical_data) { HistoricalData.create!(date: date, active_user_count: active_user_count) }
context "when there is no active user count restriction" do context "when there is no active user count restriction" do
...@@ -39,13 +39,13 @@ describe License do ...@@ -39,13 +39,13 @@ describe License do
gl_license.restrictions = { active_user_count: active_user_count - 1 } gl_license.restrictions = { active_user_count: active_user_count - 1 }
end end
context "when the license was issued" do context "when the license started" do
it "is invalid" do it "is invalid" do
expect(license).to_not be_valid expect(license).to_not be_valid
end end
end end
context "after the license was issued" do context "after the license started" do
let(:date) { Date.today } let(:date) { Date.today }
it "is valid" do it "is valid" do
...@@ -53,16 +53,16 @@ describe License do ...@@ -53,16 +53,16 @@ describe License do
end end
end end
context "in the year before the license was issued" do context "in the year before the license started" do
let(:date) { License.current.issued_at - 6.months } let(:date) { License.current.starts_at - 6.months }
it "is invalid" do it "is invalid" do
expect(license).to_not be_valid expect(license).to_not be_valid
end end
end end
context "earlier than a year before the license was issued" do context "earlier than a year before the license started" do
let(:date) { License.current.issued_at - 2.years } let(:date) { License.current.starts_at - 2.years }
it "is valid" do it "is valid" do
expect(license).to be_valid expect(license).to be_valid
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment