Class: NewsfeedDay

Inherits:
Object
  • Object
show all
Defined in:
app/services/newsfeed_day.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date) ⇒ NewsfeedDay

Returns a new instance of NewsfeedDay.


5
6
7
8
9
10
11
12
# File 'app/services/newsfeed_day.rb', line 5

def initialize(date)
  @day = date.midnight
  @title = @day.strftime("%Y-%m-%d")
  @badges_added = Project.where('badge_in_readme = ? AND badge_in_readme_added_at > ? AND badge_in_readme_added_at <= ?', true, @day, @day+1.day).count
  @badges_removed = Project.where('badge_in_readme = ? AND badge_in_readme_removed_at > ? AND badge_in_readme_removed_at <= ?', false, @day, @day+1.day).count
  @not_forked_projects_created = Project.where('fork = ? AND created_at > ? AND created_at <= ?', false, @day, @day+1.day).count
  @failed_builds = Build.where('status LIKE ? AND created_at > ? AND created_at <= ?', "failed:%", @day, @day+1.day).count
end

Instance Attribute Details

#badges_addedObject (readonly)

Returns the value of attribute badges_added


2
3
4
# File 'app/services/newsfeed_day.rb', line 2

def badges_added
  @badges_added
end

#badges_removedObject (readonly)

Returns the value of attribute badges_removed


2
3
4
# File 'app/services/newsfeed_day.rb', line 2

def badges_removed
  @badges_removed
end

#failed_buildsObject (readonly)

Returns the value of attribute failed_builds


2
3
4
# File 'app/services/newsfeed_day.rb', line 2

def failed_builds
  @failed_builds
end

#not_forked_projects_createdObject (readonly)

Returns the value of attribute not_forked_projects_created


2
3
4
# File 'app/services/newsfeed_day.rb', line 2

def not_forked_projects_created
  @not_forked_projects_created
end

#titleObject (readonly)

Returns the value of attribute title


2
3
4
# File 'app/services/newsfeed_day.rb', line 2

def title
  @title
end