Script for generating Vortragsreihe event placeholders
This commit is contained in:
parent
c2f1975499
commit
5a8cb978dc
2 changed files with 77 additions and 14 deletions
38
scripts/generate-vortragsplatzhalter.rb
Executable file
38
scripts/generate-vortragsplatzhalter.rb
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env ruby
|
||||
# encoding: utf-8
|
||||
|
||||
require 'rubygems'
|
||||
require 'bundler/setup'
|
||||
|
||||
require 'date'
|
||||
require 'yaml'
|
||||
|
||||
|
||||
def event(day, dayoffset, title)
|
||||
startDate = Time.local(day.year, day.month, day.day + dayoffset, 19, 30, 0)
|
||||
{
|
||||
'title' => title,
|
||||
'startdate' => startDate,
|
||||
'duration' => '2h',
|
||||
'location' => {
|
||||
'location' => 'bib'
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
year=ARGV[0].to_i
|
||||
result = { 'events' => [] }
|
||||
|
||||
for month in 1..12
|
||||
date = Date.new(year,month,1)
|
||||
firstthursday = if (date.wday<=4)
|
||||
date + (4-date.wday)
|
||||
else
|
||||
date + (11-date.wday)
|
||||
end
|
||||
result['events'] << event(firstthursday, 7, 'CCCS Vortragsreihe (Thema noch offen)')
|
||||
end
|
||||
|
||||
puts result.to_yaml
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue