diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2024-10-10 22:35:39 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2024-10-10 22:35:39 +0200 |
commit | 9d1d88c66da5b15d026fd07c58463d3bdd62dd87 (patch) | |
tree | 8bf7435984314edb49987706113c1f411849a698 | |
parent | bc47fa5f7ba84d7ad57ed4bb40e5851cf97c4023 (diff) | |
download | ramaskrik-program-main.tar.gz ramaskrik-program-main.tar.bz2 ramaskrik-program-main.zip |
Use floating point division to calculate start coordinate and height of
events. Integer division truncated the values to they got a bit off.
A few other minor adjustments was made.
-rw-r--r-- | index.html.erb | 2 | ||||
-rwxr-xr-x | ramaskrik-program.rb | 6 | ||||
-rw-r--r-- | styles.css | 1 |
3 files changed, 5 insertions, 4 deletions
diff --git a/index.html.erb b/index.html.erb index 62f31d2..2949dc8 100644 --- a/index.html.erb +++ b/index.html.erb @@ -36,7 +36,7 @@ <h3>Kl.</h3> <div class="time-column-inner"> <% (start_time..end_time).step(3600 / 4) do |time| %> - <div class="timestamp" style="top: <%= (time - start_time).to_i / 50 - 5 %>px; height: 10px;"> + <div class="timestamp" style="top: <%= (time - start_time).to_i / 50 %>px; height: 10px;"> <%= Time.at(time).strftime('%H:%M') %> </div> <% end %> diff --git a/ramaskrik-program.rb b/ramaskrik-program.rb index cd22839..f2b308b 100755 --- a/ramaskrik-program.rb +++ b/ramaskrik-program.rb @@ -33,8 +33,8 @@ class EventDecorator < SimpleDelegator attr_reader :height def calc_offsets(time_offset) - @offset = 5 + (start_time - time_offset).to_i / 50 - @height = 5 + duration / 50; + @offset = 5 + (start_time - time_offset).to_f / 50 + @height = 5 + duration.to_f / 50; start_time + duration end end @@ -52,7 +52,7 @@ class SortedEventList .sort{ |a,b| a.start_time - b.start_time } .map{ |e| EventDecorator.new(e) } - @start_time = @events.first.start_time - (@events.first.start_time.min * 60) + @start_time = @events.first.start_time # - (@events.first.start_time.min * 60) @events.group_by{|e| e.venue}.each do |venue, events| time_offset = start_time @@ -43,6 +43,7 @@ a:hover { } .timestamp { position: absolute; + font-family: Helvetica, Arial, "Sans Serif"; font-size: 10px; } .event-item { |