Skip to content

Commit

Permalink
Working on scheduling
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenny Allen committed Jun 19, 2014
1 parent 6a09d02 commit 2394c86
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 20 deletions.
1 change: 1 addition & 0 deletions availability_hash
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"Sunday"=>{:availableHours=>[false, false, false, false, false, false, false, false, false, false, true, true, false, false, false, false, false, false, false, false, false, false, false, false], :totalHours=>2}, "Monday"=>{:availableHours=>[false, false, false, false, false, false, false, false, false, false, false, false, false, true, true, false, false, false, false, false, false, false, false, false], :totalHours=>2}, "Tuesday"=>{:availableHours=>[false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, true, true, false, false, false, false], :totalHours=>3}, "Wednesday"=>{:availableHours=>[false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false], :totalHours=>1}, "Thursday"=>{:availableHours=>[false, false, false, false, false, false, false, false, false, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false], :totalHours=>2}, "Friday"=>{:availableHours=>[false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false], :totalHours=>0}, "Saturday"=>{:availableHours=>[false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false], :totalHours=>0}}
1 change: 1 addition & 0 deletions coursearray

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions coursearray.rb

Large diffs are not rendered by default.

28 changes: 24 additions & 4 deletions mama.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require 'open-uri'
require 'pry'

require_relative 'practice_hash'
require_relative 'scraper'

enable :sessions
Expand Down Expand Up @@ -100,10 +101,19 @@ def timeToNum(timestr)
if timestr == nil || timestr == ''
timenum = 0
else
timenum = timestr[0].to_i
if timestr.include?('pm')
timenum += 12
timearr = timestr.split(':')
timenum = timearr[0].to_i

if timestr.include?('PM')
if timenum != 12
timenum += 12
end
end

if timenum == 12 && timestr.include?('AM')
timenum = 0
end

end

timenum
Expand All @@ -120,6 +130,12 @@ def createDayArray(starttime, endtime)



def oneWeekSchedule

end



post '/scheduler/yournewschedule' do

daysOfWeek = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
Expand All @@ -139,11 +155,15 @@ def createDayArray(starttime, endtime)
daysOfWeek.each do |day, hash|
starttime = timeToNum(params[day+"-starttime"])
endtime = timeToNum(params[day+"-endtime"])
puts "Starttime" + params[day+"-starttime"] + " Parsed Input: " + starttime.to_s
puts "EndTime" + params[day+"-endtime"] + " Parsed Input: " + endtime.to_s
hash[:availableHours] = createDayArray(starttime, endtime)
hash[:totalHours] = endtime - starttime
end

puts daysOfWeek


File.open('availability_hash', 'w') {|file| file.write(daysOfWeek.to_s)}



Expand Down
5 changes: 5 additions & 0 deletions practice_hash.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def practice_hash

{:professor=>"Shiller, Robert J.", :number=>"ECON 252", :link=>"/economics/econ-252-08", :department=>"Economics", :department_link=>"/economics", :title=>"Financial Markets (2008)", :sessions=>[{:title=>"Finance and Insurance as Powerful Forces in Our Economy and Society", :link=>"/economics/econ-252-08/lecture-1"}, {:title=>"The Universal Principle of Risk Management: Pooling and the Hedging of Risks", :link=>"/economics/econ-252-08/lecture-2"}, {:title=>"Technology and Invention in Finance", :link=>"/economics/econ-252-08/lecture-3"}, {:title=>"Portfolio Diversification and Supporting Financial Institutions (CAPM Model)", :link=>"/economics/econ-252-08/lecture-4"}, {:title=>"Insurance: The Archetypal Risk Management Institution", :link=>"/economics/econ-252-08/lecture-5"}, {:title=>"Efficient Markets vs. Excess Volatility", :link=>"/economics/econ-252-08/lecture-6"}, {:title=>"Behavioral Finance: The Role of Psychology", :link=>"/economics/econ-252-08/lecture-7"}, {:title=>"Human Foibles, Fraud, Manipulation, and Regulation", :link=>"/economics/econ-252-08/lecture-8"}, {:title=>"Guest Lecture by David Swensen", :link=>"/economics/econ-252-08/lecture-9"}, {:title=>"Debt Markets: Term Structure", :link=>"/economics/econ-252-08/lecture-10"}, {:title=>"Midterm Exam 1", :link=>"/economics/econ-252-08/exam-1"}, {:title=>"Stocks", :link=>"/economics/econ-252-08/lecture-11"}, {:title=>"Real Estate Finance and Its Vulnerability to Crisis", :link=>"/economics/econ-252-08/lecture-12"}, {:title=>"Banking: Successes and Failures", :link=>"/economics/econ-252-08/lecture-13"}, {:title=>"Guest Lecture by Andrew Redleaf", :link=>"/economics/econ-252-08/lecture-14"}, {:title=>"Guest Lecture by Carl Icahn", :link=>"/economics/econ-252-08/lecture-15"}, {:title=>"The Evolution and Perfection of Monetary Policy", :link=>"/economics/econ-252-08/lecture-16"}, {:title=>"Midterm Exam 2", :link=>"/economics/econ-252-08/exam-2"}, {:title=>"Investment Banking and Secondary Markets", :link=>"/economics/econ-252-08/lecture-17"}, {:title=>"Professional Money Managers and Their Influence", :link=>"/economics/econ-252-08/lecture-18"}, {:title=>"Brokerage, ECNs, etc.", :link=>"/economics/econ-252-08/lecture-19"}, {:title=>"Guest Lecture by Stephen Schwarzman", :link=>"/economics/econ-252-08/lecture-20"}, {:title=>"Forwards and Futures", :link=>"/economics/econ-252-08/lecture-21"}, {:title=>"Stock Index, Oil and Other Futures Markets", :link=>"/economics/econ-252-08/lecture-22"}, {:title=>"Options Markets", :link=>"/economics/econ-252-08/lecture-23"}, {:title=>"Making It Work for Real People: The Democratization of Finance", :link=>"/economics/econ-252-08/lecture-24"}, {:title=>"Okun Lecture: Learning from and Responding to Financial Crisis, Part I (Guest Lecture by Lawrence Summers)", :link=>"/economics/econ-252-08/lecture-25"}, {:title=>"Okun Lecture: Learning from and Responding to Financial Crisis, Part II (Guest Lecture by Lawrence Summers)", :link=>"/economics/econ-252-08/lecture-26"}, {:title=>"Final Exam", :link=>"/economics/econ-252-08/exam-3"}], :time=>58}

end
4 changes: 2 additions & 2 deletions public/newcal.ics
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ VERSION:2.0
PRODID:icalendar-ruby
CALSCALE:GREGORIAN
BEGIN:VEVENT
DTSTAMP:20140619T041720Z
UID:2014-06-19T00:17:20-04:00_462612991@Jennys-Macbook-Air-4.local
DTSTAMP:20140619T135512Z
UID:2014-06-19T09:55:12-04:00_166071387@Jennys-Macbook-Air-4.local
DTSTART:20140613T083000
DTEND:20140613T093000
SUMMARY:This is a summary with params.
Expand Down
26 changes: 12 additions & 14 deletions views/courseselection.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,25 @@
<th>Course Number</th>
<th>Course Time</th>
</tr> -->
<% courses = Scraper.coursearray %>
<% courses.each do |course| %>
<tr>
<thead>
<!-- <% courses = Scraper.coursearray %> -->
<!-- <thead> -->
<tr>
<th></th>
<th>Course Number</th>
<th>Course link</th>
</tr>
</thead>
<!-- </thead> -->
<% courses = Scraper.coursearray %>
<% courses.each do |course| %>
<tbody>
<tr class="pure-table-striped">
<td><%= course[:title] %></td>
<td><%= course[:number] %></td>
<% full_link = 'http://oyc.yale.edu' + course[:link] %>
<td><a href=<%= full_link %> target='_blank'><%= course[:title] %></a></td>
<td><%= course[:professor] %></td>
<td>~<%= course[:time] %> Hours</td>
</tr>
<tbody>
<tr class="pure-table-striped">
<td><%= course[:title] %></td>
<td><%= course[:number] %></td>
<% full_link = 'http://oyc.yale.edu' + course[:link] %>
<td><a href=<%= full_link %> target='_blank'> <%= course[:title] %></a></td>
<td><%= course[:professor] %></td>
<td>~<%= course[:time] %> Hours</td>
</tr>
<% end %>
</table>
</body>
Expand Down

0 comments on commit 2394c86

Please sign in to comment.