Merge pull request #2390 from hennevogel/bugfix/schedules

Various update fixes
This commit is contained in:
Ana María Martínez Gómez 2019-03-09 09:41:14 +01:00 committed by GitHub
commit 5a1f75e4f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 82 additions and 13 deletions

58
CHANGES.md Normal file
View file

@ -0,0 +1,58 @@
# Changes in OSEM 2.0
Not release yet...
## Update from 1.0
### Multiple Schedules
A conference can have multiple schedules now so it's easier for organizers to
test schedules and collaborate on different versions.
For this some of the existing data needs to be changed. If you update
from 1.0 please run this rake task to move your old schedules to the
new system.
```
bundle exec rake data:move_events_attributes RAILS_ENV=production
```
### Dropped visit/campaign tracking
We have dropped the feature to track visits and campaigns (utm parameters)
inside OSEM. We recommend you use [matomo](https://matomo.org/) for things
like that. Before you update to OSEM 1.1 you should drop all the data we
have collected.
```
bundle exec rake data:drop_all_ahoy_events RAILS_ENV=production
```
### Conference wide revision history
There is now a conference wide revision history that will show organizers
everything that is happening. To be able to do this we need to change old
data.
```
bundle exec rake data:set_conference_in_versions RAILS_ENV=production
```
# Changes in OSEM 1.0
[Released May 24, 2016](https://osem.io/1.0)
Our first release after developing and using this app in production for
many years. Too many changes to list, see the release announcement to
learn what OSEM is about.
https://osem.io/1.0
## Update from master
### Configuration through the environment
If you have deployed OSEM from master before there is one thing you need to do
manually. OSEM is now configured through environment variables and not through
the config/options.yml anymore. There is a rake task to migrate your existing
data to a .env file that OSEM will use:
```
bundle exec rake data:migrate:config2dotenv RAILS_ENV=production
```

View file

@ -31,10 +31,23 @@ class Ability
event.state == 'confirmed'
end
can [:show, :events], Schedule do |schedule|
schedule.program.schedule_public
end
# can view Commercials of confirmed Events
can :show, Commercial, commercialable_type: 'Event', commercialable_id: Event.where(state: 'confirmed').pluck(:id)
can [:show, :create], User
unless ENV['OSEM_ICHAIN_ENABLED'] == 'true'
can [:index, :show], Survey, surveyable_type: 'Conference'
# Things that are possible without ichain enabled that are **not*+ possible with ichain mode enabled.
if ENV['OSEM_ICHAIN_ENABLED'] != 'true'
# There is no reliable way for this workflow (enable not logged in users to fill out a form, then telling
# them to sign up once they submit) in ichain. So enable it only without ichain.
# FIXME: The following abilities need to be checked. Are they about the type of workflow mentioned above? Or are
# they just here because they worked in development mode (without ichain). We are suspicious that it's the latter!
can :show, Registration do |registration|
registration.new_record?
end
@ -51,12 +64,6 @@ class Ability
can [:new, :create], Event do |event|
event.program.cfp_open? && event.new_record?
end
can [:show, :events], Schedule do |schedule|
schedule.program.schedule_public
end
can [:index, :show], Survey, surveyable_type: 'Conference'
end
end

View file

@ -79,8 +79,8 @@
= link_to (current_or_last_object_state('Event', object.event_id).try(:title) || 'deleted'),
admin_conference_program_event_path(conference_short_title, object.event_id)
in
= link_to "Schedule #{event_schedule.schedule_id}",
admin_conference_schedule_path(conference_short_title, event_schedule.schedule_id)
= link_to "Schedule #{version.item.schedule_id}",
admin_conference_schedule_path(conference_short_title, version.item.schedule_id)
- when 'Schedule'
= link_if_alive version, "Schedule #{version.item_id}",

View file

@ -6,8 +6,8 @@ namespace :data do
task move_events_attributes: :environment do
Program.all.each do |program|
schedule = Schedule.create(program: program)
program.selected_schedule = schedule
program.save
program.selected_schedule = schedule unless program.selected_schedule
program.save!
program.events.each do |event|
unless event.start_time.nil? && event.room_id.nil?
# we can not use .room as this relation has been removed

View file

@ -10,8 +10,12 @@ namespace :data do
version.update_attributes(conference_id: version.item_id)
elsif version.item_type == 'Event'
event = (version.item || version.reify || version.next.reify)
event = version.item
unless event || Event.find_by(id: version.item_id)
puts 'Not updating versions of deleted event...'
next
end
event ||= (version.reify || version.next.reify)
conference_id = if event.try(:program)
event.program.conference_id
# Event had attribute conference_id before it was replaced with program_id