Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cleaning-portalmec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard Fernando Heise Ferreira
cleaning-portalmec
Commits
3a5eeaf9
Commit
3a5eeaf9
authored
1 year ago
by
tmn21
Browse files
Options
Downloads
Patches
Plain Diff
ISSUE
#52
: UPDATE high_streak function
parent
d4b544bf
No related branches found
Branches containing commit
No related tags found
1 merge request
!49
ISSUE #52: UPDATE high_streak function
Pipeline
#34716
failed
1 year ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/models/user.rb
+8
-3
8 additions, 3 deletions
app/models/user.rb
with
8 additions
and
3 deletions
app/models/user.rb
+
8
−
3
View file @
3a5eeaf9
...
...
@@ -388,6 +388,12 @@ class User < ApplicationRecord
end
end
def
update_high_streak
()
if
self
.
high_streak
<
self
.
streak
self
.
update
(
high_streak:
streak
)
end
end
def
update_streak
()
if
self
.
last_action_at
==
Date
.
today
return
...
...
@@ -397,9 +403,7 @@ class User < ApplicationRecord
if
self
.
last_action_at
==
Date
.
yesterday
self
.
update
(
last_action_at:
Date
.
today
)
self
.
update
(
streak:
streak
+
1
)
if
self
.
high_streak
<
self
.
streak
self
.
update
(
high_streak:
streak
)
end
update_high_streak
return
end
...
...
@@ -407,6 +411,7 @@ class User < ApplicationRecord
if
(
Date
.
today
-
self
.
last_action_at
).
to_i
>=
2
self
.
update
(
last_action_at:
Date
.
today
)
self
.
update
(
streak:
1
)
update_high_streak
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment