Skip to content

Instantly share code, notes, and snippets.

@igal
Created April 28, 2010 00:08
Show Gist options
  • Save igal/381532 to your computer and use it in GitHub Desktop.
Save igal/381532 to your computer and use it in GitHub Desktop.
# This gist describe's the OpenConferenceWare data structures
# related to user favorites.
#
# The hope is that this will help with creating an algorithm that
# can schedule sessions in an optimal way based on:
#
# * User favorites: Don't schedule talks at same time if many
# users favorite them together.
# * Tracks: Balance out tracks so that there aren't, for example,
# only "cooking" track talks happening at the same time.
# * Times: A proposal's session_type has a duration in minutes
# which needs to be accounted for.
# * Speakers: A speaker can't give multiple talks at the same time.
# * Rooms: We'll have multiple talks running at the same time in
# rooms of different capacity, we currently have no data in the
# system estimating how big an audience a talk will get, but can
# add this with some very rough ballpark guesses.
#
# The items below are represented for clarity as simple Ruby hashes.
# The actual data is stored and accessed via ActiveRecord classes
# with many more attributes and built-in logic for traversing
# an association, e.g. `User.find(1).proposals` will retrieve
# a user with id #1 and return their proposal objects. It may
# be easier to work with the real objects for this, but this
# high-level overview is still useful for explaining the data.
#
# Naming convention: Every item has an "id" field that uniquely
# identifies it. Some items have foreign keys, these are represented
# as fields whose names end with "_id", e.g., "user_id" is a foreign
# key that refers to a particular user record.
# A user
igal = {
:id => 1,
:first_name => "Igal",
:last_name => "Koshevoy"
}
# Another user
jamey = {
:id => 431,
:first_name => "Jamey",
:last_name => "Sharp"
}
# A proposal belongs to a track and session_type
proposal = {
:id => 291,
:title => "Unlikely tools for pair programming",
:session_type_id => 5,
:track_id => 9,
:room_id => nil
}
# A user's proposal, associates a user and proposal
user_proposal = {
:id => 282,
:proposal_id => 291,
:user_id => 431
}
# A track for the above proposal
track = {
:id => 9,
:title => "Cooking"
}
# A session type for the above proposal -- duration is length of talk in minutes
session_type = {
:id => 5,
:title => "Short Form",
:duration => 45
}
# A room that a talk can be scheduled in
room = {
:id => 8,
:title => "Marquam",
:capacity => 80
}
# And finally ... a user's favorite, associates a user and proposal
user_favorite = {
:id => 2931,
:user_id => 1,
:proposal_id => 291
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment