Skip to content

Commit

Permalink
Add published_at/announced_at columns to Talk and use date fo…
Browse files Browse the repository at this point in the history
…r talk date (#616)
  • Loading branch information
marcoroth authored Jan 31, 2025
1 parent 02c1f11 commit d585358
Show file tree
Hide file tree
Showing 220 changed files with 9,155 additions and 4,243 deletions.
37 changes: 15 additions & 22 deletions app/models/talk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Table name: talks
#
# id :integer not null, primary key
# announced_at :datetime
# date :date indexed, indexed => [video_provider]
# description :text default(""), not null
# duration_in_seconds :integer
Expand All @@ -14,6 +15,7 @@
# language :string default("en"), not null
# like_count :integer default(0)
# meta_talk :boolean default(FALSE), not null
# published_at :datetime
# slides_url :string
# slug :string default(""), not null, indexed
# start_seconds :integer
Expand Down Expand Up @@ -93,12 +95,17 @@ class Talk < ApplicationRecord
validates :language, presence: true,
inclusion: {in: Language.alpha2_codes, message: "%{value} is not a valid IS0-639 alpha2 code"}

validates :date, presence: true
# validates :published_at, presence: true, if: :published? # TODO: enable

# delegates
delegate :name, to: :event, prefix: true, allow_nil: true

# callbacks
before_validation :set_kind, if: -> { !kind_changed? }

WATCHABLE_PROVIDERS = ["youtube", "mp4", "vimeo"]

# enums
enum :video_provider, %w[youtube mp4 vimeo scheduled not_published not_recorded parent children].index_by(&:itself)
enum :kind,
Expand Down Expand Up @@ -213,7 +220,7 @@ def formatted_kind
scope :for_topic, ->(topic_slug) { joins(:topics).where(topics: {slug: topic_slug}) }
scope :for_speaker, ->(speaker_slug) { joins(:speakers).where(speakers: {slug: speaker_slug}) }
scope :for_event, ->(event_slug) { joins(:event).where(events: {slug: event_slug}) }
scope :watchable, -> { where(video_provider: [:youtube, :mp4, :vimeo]) }
scope :watchable, -> { where(video_provider: WATCHABLE_PROVIDERS) }

def managed_by?(visiting_user)
return false unless visiting_user.present?
Expand All @@ -222,6 +229,10 @@ def managed_by?(visiting_user)
speakers.exists?(user: visiting_user)
end

def published?
video_provider.in?(WATCHABLE_PROVIDERS)
end

def to_meta_tags
{
title: title,
Expand Down Expand Up @@ -365,18 +376,6 @@ def related_talks(limit: 6)
Talk.includes(event: :organisation).where(id: ids)
end

def announced_at
Time.parse(static_metadata[:announced_at])
rescue
nil
end

def published_at
Time.parse(static_metadata[:published_at])
rescue
nil
end

def formatted_date
date.strftime("%B %d, %Y")
rescue => _e
Expand Down Expand Up @@ -462,19 +461,13 @@ def update_from_yml_metadata!(event: nil)
return
end

date = static_metadata.try(:date) ||
(parent_talk && parent_talk.static_metadata.try(:date)) ||
static_metadata.try(:published_at) ||
(parent_talk && parent_talk.static_metadata.try(:published_at)) ||
event.start_date ||
event.end_date ||
Date.parse("#{static_metadata.year}-01-01")

assign_attributes(
event: event,
title: static_metadata.title,
description: static_metadata.description,
date: date,
date: static_metadata.try(:date) || parent_talk&.static_metadata.try(:date),
published_at: static_metadata.try(:published_at) || parent_talk&.static_metadata.try(:published_at),
announced_at: static_metadata.try(:announced_at) || parent_talk&.static_metadata.try(:announced_at),
thumbnail_xs: static_metadata["thumbnail_xs"] || "",
thumbnail_sm: static_metadata["thumbnail_sm"] || "",
thumbnail_md: static_metadata["thumbnail_md"] || "",
Expand Down
2 changes: 1 addition & 1 deletion app/views/talks/_talk.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
Date: <% if talk.date %> <%= talk.formatted_date %> <% else %> unknown<% end %><br>

<span class="text-gray-400">
Published: <% if talk.published_at %><%= talk.published_at.strftime("%B %d, %Y") %><% else %> not published<% end %><br>
Published: <% if talk.published_at %><%= talk.published_at.strftime("%B %d, %Y") %><% elsif talk.published? %> unknown <% else %> not published <% end %><br>
Announced: <% if talk.announced_at %><%= talk.announced_at.strftime("%B %d, %Y") %><% else %> unknown<% end %>
</span>
</p>
Expand Down
53 changes: 26 additions & 27 deletions data/aloha-rubyconf/aloha-rubyconf-2012/videos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
speakers:
- Aaron Patterson
event_name: Aloha RubyConf 2012
published_at: "2012-10-08"
date: "2012-10-08"
slides_url: https://speakerdeck.com/tenderlove/aloha-ruby-conference-2012
track: null
description: |-
Expand All @@ -28,7 +28,7 @@
speakers:
- Zach Holman
event_name: Aloha RubyConf 2012
published_at: "2012-10-08"
date: "2012-10-08"
track: Track 1
description: |-
We tuck a lot of features away on github.com.
Expand All @@ -46,7 +46,7 @@
speakers:
- Richard Schneeman
event_name: Aloha RubyConf 2012
published_at: "2012-10-08"
date: "2012-10-08"
track: Track 2
description: |-
All the Starcraft n00bs know exactly how to win. They take all the resources they can, and upgrade all the expensive tech and think to themselves, "soon i'll be unstoppable". Unfortunately "eventually unstoppable" is the same as dead right now. This type of premature optimization and abstraction can kill a business faster than not being able to scale. In this talk we'll take a look at how to pick the right unit composition (databases vs. NoSQL), balance your macro and micro (scale out vs. up), and choose the right race (programing language). If you've never played Starcraft, and can't tell a ultralisk from a firebat, don't worry there's still a room for you. Sorry, no Zerg allowed.
Expand All @@ -60,7 +60,7 @@
speakers:
- Jerry Cheung
event_name: Aloha RubyConf 2012
published_at: "2012-10-08"
date: "2012-10-08"
track: Track 1
description: |-
While Node.js is the hot new kid on the block, evented libraries like EventMachine for Ruby and Twisted for Python have existed for a long time. When does it make sense to use one over the other? What are the advantages and disadvantages to using node over ruby? In this talk, you will learn how to get the same power of concurrency enjoyed by Node.js while continuing to write in the language you know and love. Topics covered will include pubsub with redis or faye, building evented rack applications, and running evented applications alongside existing Rails apps.
Expand All @@ -73,7 +73,7 @@
speakers:
- Evan Machnic
event_name: Aloha RubyConf 2012
published_at: "2012-10-08"
date: "2012-10-08"
track: Track 2
description: |-
I started programming Rails on Windows in 2008. The experience was not the best but I still made the best of it. Fast-forward to 2012 and because of tools like RailsInstaller, Windows users have things almost easier than Mac/Linux. This talk will focus on some of the best-practices that I've found when using Windows for Ruby on Rails development and is really geared toward helping people get started programming Rails in a Windows environment. The talk is sexy and it knows it so be prepared to laugh and have fun.
Expand All @@ -88,7 +88,7 @@
speakers:
- Ben Orenstein
event_name: Aloha RubyConf 2012
published_at: "2012-10-08"
date: "2012-10-08"
track: Track 1
description: |-
Most developers know enough about refactoring to write code that's pretty good. They create short methods, and classes with one responsibility. They're also familiar with a good handful of refactorings, and the code smells that motivate them.
Expand All @@ -109,7 +109,7 @@
speakers:
- James Rosen
event_name: Aloha RubyConf 2012
published_at: "2012-10-08"
date: "2012-10-08"
track: Track 2
description: |-
As applications grow, dependency management becomes painful, tests get slower, and development becomes less joyful. Breaking up the application into services can be a great solution to these problems, but not every team is ready to leap fully into a SOA. Carson is Zendesk's compromise to this problem. It's a Rails 3 engine host: an application that contains only a Gemfile full of engines and some configuration. In this talk we'll explore the benefits and drawbacks of delivering features as engines and how this approach can act as a stepping stone from big-ball-of-mud architectures to service-oriented ones.
Expand All @@ -124,7 +124,7 @@
speakers:
- Charles Nutter
event_name: Aloha RubyConf 2012
published_at: "2012-10-08"
date: "2012-10-08"
slides_url: https://speakerdeck.com/headius/aloha-rubyconf-2012-jruby
track: Track 1
description: |-
Expand All @@ -138,7 +138,7 @@
speakers:
- Konstantin Haase
event_name: Aloha RubyConf 2012
published_at: "2012-10-08"
date: "2012-10-08"
slides_url: https://speakerdeck.com/rkh/aloha-ruby-conf-2012-message-in-a-bottle
track: Track 2
description: |-
Expand All @@ -154,7 +154,7 @@
speakers:
- Corey Haines
event_name: Aloha RubyConf 2012
published_at: "2012-10-08"
date: "2012-10-08"
track: Track 1
description: |-
Mocks, Stubs and other test doubles are a common and convenient scapegoat when talking about fragile test suites. But test doubles can be useful guides, highlighting design issues and in our application. By treating them as companions, we can find our way to long-term maintainable designs and effective test suites.
Expand All @@ -171,7 +171,7 @@
speakers:
- Kowsik Guruswamy
event_name: Aloha RubyConf 2012
published_at: "2012-10-08"
date: "2012-10-08"
track: Track 2
description: |-
There’s nothing more frustrating for a developer than spending months creating an application and then having it fail because of performance issues. That’s why integrating application performance management into each step of the development lifecycle is critical to your application’s success. Of course, easy-to-use tools for performance management are rare, and often prohibitively expensive. Not to mention that they don’t reflect actual user behavior. In order for APM solutions to succeed in the Ruby community, they must be affordable, easy to use, require no scripting; and easily integrate into the development process – be it a PaaS system such as Heroku or some other delivery system. From idea formation to final delivery, Rubyists must know their product is working every step of the way.
Expand All @@ -186,7 +186,7 @@
speakers:
- Wesley Beary
event_name: Aloha RubyConf 2012
published_at: "2012-10-08"
date: "2012-10-08"
track: null
description: |-
Open source is hard but it gets much easier with a community backing you. I tried many approaches while developing fog, and thankfully, the resulting community is amazing. Now I'm doing my best to apply the same principles to the Heroku CLI and other open source projects. I make mistakes and often get lucky, but I have learned a lot about fostering community in the process. This session distills some of my techniques and explains how you can help build community around your favorite projects.
Expand All @@ -209,10 +209,9 @@
speakers:
- Chad Fowler
event_name: Aloha RubyConf 2012
published_at: "2012-10-09"
date: "2012-10-09"
track: Track 1
description: |-
description: ""
video_provider: youtube
video_id: P4xSmYr7PEg

Expand All @@ -221,7 +220,7 @@
speakers:
- Patrick Huesler
event_name: Aloha RubyConf 2012
published_at: "2012-10-09"
date: "2012-10-09"
track: Track 2
description: |-
A story of a Ruby programmer having to understand that learning Erlang is more than just syntax. Learn differences in paradigms, pitfalls and applied use cases for this incredibly powerful language.
Expand All @@ -244,7 +243,7 @@
speakers:
- Mark Bates
event_name: Aloha RubyConf 2012
published_at: "2012-10-09"
date: "2012-10-09"
track: Track 1
description: |-
CoffeeScript is taking the world, and particularly the Rails eco system, by storm. This little language has provided an almost Ruby like abstraction onto of JavaScript. CoffeeScript is trying to make writing front end code as much fun as Ruby makes writing backend code.
Expand All @@ -259,7 +258,7 @@
speakers:
- Ben Smith
event_name: Aloha RubyConf 2012
published_at: "2012-10-09"
date: "2012-10-09"
track: Track 2
description: |-
Do you ever use "gem install"? What about bundle?
Expand All @@ -280,7 +279,7 @@
speakers:
- James Edward Gray II
event_name: Aloha RubyConf 2012
published_at: "2012-10-09"
date: "2012-10-09"
slides_url: https://speakerdeck.com/jeg2/10-things-you-didnt-know-ruby-could-do
track: Track 1
description: |-
Expand All @@ -298,7 +297,7 @@
speakers:
- Ray Hightower
event_name: Aloha RubyConf 2012
published_at: "2012-10-09"
date: "2012-10-09"
track: Track 2
description: |-
RubyMotion is a tool that lets Ruby developers write native iOS apps using the Ruby language. It's based on MacRuby which is an implementation of the Ruby language for Mac OS X. This talk will introduce RubyMotion with some simple live code demos and a twist of TDD. The level is introductory; you don't need to know Ruby or iOS to attend.
Expand All @@ -313,7 +312,7 @@
speakers:
- Mitchell Hashimoto
event_name: Aloha RubyConf 2012
published_at: "2012-10-09"
date: "2012-10-09"
track: Track 1
description: |-
We all interface with Ruby libraries every day, so we all know what makes up a "good" Ruby API. But there is a lot more to a "good" library than just the API: proper logging, flexible configuration, a sane exception hierarchy, and useful documentation, just to name a few. How do we do these things properly? What pros/cons are there to different approaches? Unfortunately, no one really talks about these things, despite being very important to the overall feel of a library.
Expand All @@ -328,7 +327,7 @@
speakers:
- Brandon Keepers
event_name: Aloha RubyConf 2012
published_at: "2012-10-09"
date: "2012-10-09"
track: Track 2
description: |-
We all know that Git is amazing for storing code. It is fast, reliable, flexible, and it keeps our project history nuzzled safely in its object database while we sleep soundly at night.
Expand All @@ -349,7 +348,7 @@
speakers:
- Glenn Gillen
event_name: Aloha RubyConf 2012
published_at: "2012-10-09"
date: "2012-10-09"
track: Track 1
description: |-
As developers and engineers we've spent a lot of time improving our tools to make our lives easier. Somewhere along the way, those improvements have introduced a new threat to our livelihood... Designers! Learn about how we've got ourselves into this place, why we have to lift our game, and why that can only be a good thing for everyone.
Expand All @@ -362,7 +361,7 @@
speakers:
- Charles Max Wood
event_name: Aloha RubyConf 2012
published_at: "2012-10-09"
date: "2012-10-09"
track: Track 2
description: |-
For many small sites with a minimal amount of complexity, a single rails application works fine. The problem is that as the application's complexity and scope grow, several problems arise. These include: heavy coupling, increased load and response times, and test complexity. All of these cause your feature development to slow considerably.
Expand All @@ -381,7 +380,7 @@
speakers:
- Noah Zoschke
event_name: Aloha RubyConf 2012
published_at: "2012-10-09"
date: "2012-10-09"
track: Track 1
description: |-
The Heroku application platform makes deploying, running and scaling applications incredibly easy.
Expand All @@ -404,7 +403,7 @@
speakers:
- Lori Olson
event_name: Aloha RubyConf 2012
published_at: "2012-10-09"
date: "2012-10-09"
track: Track 2
description: |-
Sound familiar? The Rails ecosystem has grown in leaps and bounds, like the Java ecosystem did in its’ early days. So many languages, frameworks, plugins, engines, libraries and tools. So little time to deliver your new project.
Expand All @@ -423,7 +422,7 @@
speakers:
- Matt Aimonetti
event_name: Aloha RubyConf 2012
published_at: "2012-10-09"
date: "2012-10-09"
slides_url: https://speakerdeck.com/matt_aimonetti/mmmm-dot-mruby-everywhere-and-revisiting-ruby
track: null
description: |-
Expand Down
Loading

0 comments on commit d585358

Please sign in to comment.