mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-16 13:14:03 +00:00
Implements recent items tabs and top submitter for dashboard
This commit is contained in:
parent
25a1c116fd
commit
28293cb4c4
11 changed files with 186 additions and 1 deletions
|
|
@ -239,8 +239,46 @@ class Conference < ActiveRecord::Base
|
|||
result
|
||||
end
|
||||
|
||||
##
|
||||
# Returns a hash with person => submissions ordered by submissions for all conferences
|
||||
#
|
||||
# ====Returns
|
||||
# * +hash+ -> person: submissions
|
||||
def self.get_top_submitter(limit = 5)
|
||||
submitter = EventPerson.where('event_role = ?', 'submitter').limit(limit).group(:person_id)
|
||||
counter = submitter.count
|
||||
calculate_person_submission_hash(submitter, counter)
|
||||
end
|
||||
|
||||
##
|
||||
# Returns a hash with person => submissions ordered by submissions
|
||||
#
|
||||
# ====Returns
|
||||
# * +hash+ -> person: submissions
|
||||
def get_top_submitter(limit = 5)
|
||||
submitter = EventPerson.joins(:event).
|
||||
where('event_role = ? and conference_id = ?', 'submitter', id).
|
||||
limit(limit).group(:person_id)
|
||||
|
||||
counter = submitter.count
|
||||
Conference.calculate_person_submission_hash(submitter, counter)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
##
|
||||
# Returns a hash with person => submissions ordered by submissions for all conferences
|
||||
#
|
||||
# ====Returns
|
||||
# * +hash+ -> person: submissions
|
||||
def self.calculate_person_submission_hash(submitter, counter)
|
||||
result = {}
|
||||
submitter.each do |s|
|
||||
result[s.person] = counter[s.person_id]
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
##
|
||||
# Creates a venue and sets self.venue_id to it's id. Used as before_create.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -48,6 +48,10 @@ class User < ActiveRecord::Base
|
|||
details += "#{self.created_at}<br>"
|
||||
end
|
||||
|
||||
def confirmed?
|
||||
!confirmed_at.nil?
|
||||
end
|
||||
|
||||
private
|
||||
def create_person
|
||||
# TODO Search people for existing email address, add to their account
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue