Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
9
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
CodeStats
code-stats
Commits
ca9c9b2e
Commit
ca9c9b2e
authored
Dec 24, 2020
by
Mikko Ahlroth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix docs
parent
38321deb
Pipeline
#233993482
passed with stages
in 5 minutes and 10 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
6 deletions
+6
-6
lib/code_stats/xp/xp_calculator.ex
lib/code_stats/xp/xp_calculator.ex
+3
-3
lib/code_stats_web/utils/profile_utils.ex
lib/code_stats_web/utils/profile_utils.ex
+1
-1
mix.exs
mix.exs
+1
-1
mix.lock
mix.lock
+1
-1
No files found.
lib/code_stats/xp/xp_calculator.ex
View file @
ca9c9b2e
...
...
@@ -17,7 +17,7 @@ defmodule CodeStats.XP.XPCalculator do
iex> CodeStats.XP.XPCalculator.get_level(-1000)
0
"""
@spec
get_level
(
I
nteger
.
t
())
::
I
nteger
.
t
()
@spec
get_level
(
i
nteger
())
::
i
nteger
()
def
get_level
(
xp
)
when
xp
>
0
do
Float
.
floor
(
@level_factor
*
:math
.
sqrt
(
xp
))
|>
trunc
...
...
@@ -28,7 +28,7 @@ defmodule CodeStats.XP.XPCalculator do
@doc
"""
Get the amount of XP required to reach the next level from the given level.
"""
@spec
get_next_level_xp
(
I
nteger
.
t
())
::
I
nteger
.
t
()
@spec
get_next_level_xp
(
i
nteger
())
::
i
nteger
()
def
get_next_level_xp
(
level
)
do
:math
.
pow
(
Float
.
ceil
((
level
+
1
)
/
@level_factor
),
2
)
|>
trunc
...
...
@@ -37,7 +37,7 @@ defmodule CodeStats.XP.XPCalculator do
@doc
"""
Get the progress to the next level in percentage.
"""
@spec
get_level_progress
(
I
nteger
.
t
())
::
I
nteger
.
t
()
@spec
get_level_progress
(
i
nteger
())
::
i
nteger
()
def
get_level_progress
(
xp
)
do
level
=
get_level
(
xp
)
current_level_xp
=
get_next_level_xp
(
level
-
1
)
...
...
lib/code_stats_web/utils/profile_utils.ex
View file @
ca9c9b2e
...
...
@@ -14,7 +14,7 @@ defmodule CodeStatsWeb.ProfileUtils do
@doc
"""
Amount of hours to go back when looking at "recent XP".
"""
@spec
recent_xp_hours
()
::
I
nteger
.
t
()
@spec
recent_xp_hours
()
::
i
nteger
()
def
recent_xp_hours
(),
do
:
12
@doc
"""
...
...
mix.exs
View file @
ca9c9b2e
...
...
@@ -61,7 +61,7 @@ defmodule CodeStats.Mixfile do
{
:bcrypt_elixir
,
"~> 2.2"
},
{
:number
,
"~> 1.0"
},
{
:earmark
,
"~> 1.4"
,
only:
:dev
},
{
:ex_doc
,
"~> 0.2
1.3
"
,
only:
:dev
},
{
:ex_doc
,
"~> 0.2
3.0
"
,
only:
:dev
},
{
:calendar
,
"~> 1.0"
},
{
:bamboo
,
"~> 1.4"
},
{
:corsica
,
"~> 1.1"
},
...
...
mix.lock
View file @
ca9c9b2e
...
...
@@ -29,7 +29,7 @@
"ecto_sql": {:hex, :ecto_sql, "3.5.3", "1964df0305538364b97cc4661a2bd2b6c89d803e66e5655e4e55ff1571943efd", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.5.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.3.0 or ~> 0.4.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d2f53592432ce17d3978feb8f43e8dc0705e288b0890caf06d449785f018061c"},
"elixir_make": {:hex, :elixir_make, "0.6.2", "7dffacd77dec4c37b39af867cedaabb0b59f6a871f89722c25b28fcd4bd70530", [:mix], [], "hexpm", "03e49eadda22526a7e5279d53321d1cced6552f344ba4e03e619063de75348d9"},
"ex2ms": {:hex, :ex2ms, "1.6.0", "f39bbd9ff1b0f27b3f707bab2d167066dd8965e7df1149b962d94c74615d0e09", [:mix], [], "hexpm", "0d1ab5e08421af5cd69146efb408dbb1ff77f38a2f4df5f086f2512dc8cf65bf"},
"ex_doc": {:hex, :ex_doc, "0.2
1.3
", "
857ec876b35a587c5d9148a2512e952e24c24345552259464b98bfbb883c7b42
", [:mix], [{:earmark, "~> 1.4", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "
0db1ee8d1547ab4877c5b5dffc6604ef9454e189928d5ba8967d4a58a801f
16
1
"},
"ex_doc": {:hex, :ex_doc, "0.2
3.0
", "
a069bc9b0bf8efe323ecde8c0d62afc13d308b1fa3d228b65bca5cf8703a529d
", [:mix], [{:earmark
_parser
, "~> 1.4
.0
", [hex: :earmark
_parser
, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "
f5e2c4702468b2fd11b10d39416ddadd2fcdd173ba2a0285ebd92c39827a5a
16"},
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
"geolix": {:hex, :geolix, "1.1.0", "8b0fe847fef486d9e8b7c21eae6cbc2d998fb249e61d3f4f136f8016b9c1c833", [:mix], [{:poolboy, "~> 1.0", [hex: :poolboy, repo: "hexpm", optional: false]}], "hexpm", "980854f2aef30c288dc79e86c5267806d704c4525fde1b75de9a92f67fb16300"},
"geolix_adapter_mmdb2": {:hex, :geolix_adapter_mmdb2, "0.4.0", "283e6b32b380c1235afde3e080642200de10badf2091e089bbb5bf6042971b4c", [:mix], [{:geolix, "~> 1.0", [hex: :geolix, repo: "hexpm", optional: false]}, {:mmdb2_decoder, "~> 2.1", [hex: :mmdb2_decoder, repo: "hexpm", optional: false]}], "hexpm", "2f30f2a90b0b3f59f4361f642de27a82f5ed32ba20f03256e716a9278efc3ac5"},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment