Skip to content
Snippets Groups Projects
Commit d4b544bf authored by Richard Fernando Heise Ferreira's avatar Richard Fernando Heise Ferreira
Browse files

Merge branch 'issue/51-create-attribute-high_streak' into 'develop'

ISSUE #51: CREATE attribute high_streak

See merge request rfhf19/cleanning-portalmec!48
parents b8b2f1e3 2d93fced
No related branches found
No related tags found
1 merge request!48ISSUE #51: CREATE attribute high_streak
Pipeline #34715 failed
......@@ -81,6 +81,7 @@
# last_sign_in_day :datetime
# last_action_at :date
# streak :integer default("0")
# high_streak :integer default("0")
class User < ApplicationRecord
include Followable
......@@ -396,6 +397,9 @@ 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
return
end
......
......@@ -111,7 +111,8 @@ class UserSerializer < ActiveModel::Serializer
:experience,
:points,
:last_action_at,
:streak
:streak,
:high_streak
attribute \
:times_blocked, if: :is_current_user?
......
......@@ -31,8 +31,6 @@ class LearningObjectPublisher
draft.id_dspace = item.id
draft.publisher = publisher
draft.save
draf.publisher.update_streak()
update_dspace(draft)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment