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
86b1efeb
Commit
86b1efeb
authored
2 years ago
by
tmn21
Browse files
Options
Downloads
Patches
Plain Diff
ISSUE
#46
: CREATE update_streak task
parent
aaeb3836
No related branches found
No related tags found
No related merge requests found
Pipeline
#34255
failed
2 years ago
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/tasks/user.rake
+14
-1
14 additions, 1 deletion
lib/tasks/user.rake
with
14 additions
and
1 deletion
lib/tasks/user.rake
+
14
−
1
View file @
86b1efeb
require
'benchmark'
require
'date'
namespace
:user
do
namespace
:user
do
desc
'Assign submitter role to users that had the teacher role'
desc
'Assign submitter role to users that had the teacher role'
task
set_submitters: :environment
do
task
set_submitters: :environment
do
...
@@ -13,5 +15,16 @@ namespace :user do
...
@@ -13,5 +15,16 @@ namespace :user do
user
.
generate_gamification_relations
user
.
generate_gamification_relations
end
end
end
end
desc
"Update users' streak"
task
:update_streaks
=>
:environment
do
Benchmark
.
bm
(
20
)
do
|
bm
|
bm
.
report
(
"Access Database:"
)
do
User
.
all
.
each
do
|
user
|
if
Date
.
today
-
user
.
last_action_at
>=
2
user
.
update_attribute
(
:streak
,
0
)
end
end
end
end
end
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