profitable 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/profitable/version.rb +1 -1
- data/lib/profitable.rb +10 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 506d907bbcbaa811d4986d49fffdc7f1874c77528fb99996f49621834a15e263
|
4
|
+
data.tar.gz: 6e37aaa616a3238b85cacfd4d3b9373781b4632fb4e4e36ad7946a8d71fa066e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aafa273d6430cd1e4c30dada038bdc83a9ecacec8c2d9be0f9f6bad642dc818399dbb494876244eb50c96c1aa3af7932ef43f56e839ab11a8b8f036a375f822f
|
7
|
+
data.tar.gz: 7dca54330874ae397c77b2400364429509dffc5de96a2096fe963984455ff4c46e67849c5305218086684beb7b1d5300815f49af252ba9e875c028c42b717c1a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# `profitable`
|
2
2
|
|
3
|
+
## [0.2.3] - 2024-09-01
|
4
|
+
|
5
|
+
- Fix the `time_to_next_mrr_milestone` estimation and make it accurate to the day
|
6
|
+
|
3
7
|
## [0.2.2] - 2024-09-01
|
4
8
|
|
5
9
|
- Improve MRR calculations with prorated churned and new MRR (hopefully fixes bad churned MRR calculations)
|
data/lib/profitable/version.rb
CHANGED
data/lib/profitable.rb
CHANGED
@@ -104,13 +104,18 @@ module Profitable
|
|
104
104
|
next_milestone = MRR_MILESTONES.find { |milestone| milestone > current_mrr }
|
105
105
|
return "Congratulations! You've reached the highest milestone." unless next_milestone
|
106
106
|
|
107
|
-
|
108
|
-
return "Unable to calculate. Need more data or positive growth." if
|
107
|
+
monthly_growth_rate = calculate_mrr_growth_rate / 100
|
108
|
+
return "Unable to calculate. Need more data or positive growth." if monthly_growth_rate <= 0
|
109
109
|
|
110
|
-
|
111
|
-
|
110
|
+
# Convert monthly growth rate to daily growth rate
|
111
|
+
daily_growth_rate = (1 + monthly_growth_rate) ** (1.0 / 30) - 1
|
112
112
|
|
113
|
-
|
113
|
+
# Calculate the number of days to reach the next milestone
|
114
|
+
days_to_milestone = (Math.log(next_milestone.to_f / current_mrr) / Math.log(1 + daily_growth_rate)).ceil
|
115
|
+
|
116
|
+
target_date = Time.current + days_to_milestone.days
|
117
|
+
|
118
|
+
"#{days_to_milestone} days left to $#{number_with_delimiter(next_milestone)} MRR (#{target_date.strftime('%b %d, %Y')})"
|
114
119
|
end
|
115
120
|
|
116
121
|
private
|