Merge branch 'master' into cfg
This commit is contained in:
commit
f9e602802e
10 changed files with 59 additions and 11 deletions
|
|
@ -4,12 +4,12 @@ function update_price($this){
|
|||
// Calculate price for row
|
||||
var value = $this.val();
|
||||
var price = $('#price_' + id).text();
|
||||
$('#total_row_' + id).text(value * price);
|
||||
$('#total_row_' + id).text((value * price).toFixed(2));
|
||||
|
||||
// Calculate total price
|
||||
var total = 0;
|
||||
$('.total_row').each(function( index ) {
|
||||
total += parseInt($(this).text());
|
||||
total += parseFloat($(this).text());
|
||||
});
|
||||
$('#total_price').text(total);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@ class SchedulesController < ApplicationController
|
|||
# the schedule takes you to today if it is a date of the schedule
|
||||
@current_day = @conference.current_conference_day
|
||||
@day = @current_day.present? ? @current_day : @dates.first
|
||||
return unless @current_day
|
||||
# the schedule takes you to the current time if it is beetween the start and the end time.
|
||||
@hour_column = @conference.hours_from_start_time(@conf_start, @conference.end_hour)
|
||||
|
||||
unless @current_day
|
||||
# the schedule takes you to the current time if it is beetween the start and the end time.
|
||||
@hour_column = @conference.hours_from_start_time(@conf_start, @conference.end_hour)
|
||||
end
|
||||
# Ids of the schedules of confrmed self_organized tracks along with the selected_schedule_id
|
||||
@selected_schedules_ids = [@conference.program.selected_schedule_id]
|
||||
@conference.program.tracks.self_organized.confirmed.each do |track|
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ module EventsHelper
|
|||
if @program.tracks.confirmed.cfp_active.any?
|
||||
form.input :track_id, as: :select,
|
||||
collection: @program.tracks.confirmed.cfp_active.pluck(:name, :id),
|
||||
include_blank: true
|
||||
include_blank: '(Please select)'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,13 @@
|
|||
class TicketScanning < ActiveRecord::Base
|
||||
belongs_to :physical_ticket
|
||||
|
||||
before_create :mark_user_present
|
||||
|
||||
private
|
||||
|
||||
def mark_user_present
|
||||
if physical_ticket.ticket.registration_ticket?
|
||||
physical_ticket.user.mark_attendance_for_conference(physical_ticket.conference)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -47,7 +47,11 @@ class User < ActiveRecord::Base
|
|||
has_many :event_users, dependent: :destroy
|
||||
has_many :events, -> { uniq }, through: :event_users
|
||||
has_many :presented_events, -> { joins(:event_users).where(event_users: {event_role: 'speaker'}).uniq }, through: :event_users, source: :event
|
||||
has_many :registrations, dependent: :destroy
|
||||
has_many :registrations, dependent: :destroy do
|
||||
def for_conference conference
|
||||
where(conference: conference).first
|
||||
end
|
||||
end
|
||||
has_many :events_registrations, through: :registrations
|
||||
has_many :ticket_purchases, dependent: :destroy
|
||||
has_many :payments, dependent: :destroy
|
||||
|
|
@ -93,6 +97,12 @@ class User < ActiveRecord::Base
|
|||
event_registration.attended
|
||||
end
|
||||
|
||||
def mark_attendance_for_conference conference
|
||||
registration = registrations.for_conference(conference)
|
||||
registration.attended = true
|
||||
registration.save
|
||||
end
|
||||
|
||||
def name
|
||||
self[:name].blank? ? username : self[:name]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -106,7 +106,8 @@
|
|||
= 'booth'
|
||||
- booth = current_or_last_object_state(version.item_type, version.item_id)
|
||||
= link_if_alive version, booth.title,
|
||||
admin_conference_booth_path(conference_id: Conference.find(version.conference_id).short_title, id: version.item_id )
|
||||
admin_conference_booth_path(conference_id: Conference.find(version.conference_id).short_title, id: version.item_id ),
|
||||
conference
|
||||
|
||||
- when 'Program'
|
||||
= link_if_alive version, 'program',
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
- if @program.event_types.any?
|
||||
You can submit proposals for
|
||||
= "#{event_types(@conference)}."
|
||||
- if @program.tracks.any?
|
||||
- if @program.tracks.confirmed.cfp_active.any?
|
||||
Proposals should fit in one of the
|
||||
= "#{pluralize(@program.tracks.confirmed.cfp_active.count, 'track')}:"
|
||||
= "#{tracks(@conference)}."
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ describe Admin::TicketScanningsController do
|
|||
let(:admin) { create(:admin) }
|
||||
let(:conference) { create(:conference) }
|
||||
let(:user) { create(:user) }
|
||||
let(:paid_ticket_purchase) { create(:ticket_purchase, conference: conference, user: user) }
|
||||
let!(:registration) { create(:registration, conference: conference, user: user) }
|
||||
let(:registration_ticket) { create(:registration_ticket, conference: conference) }
|
||||
let(:paid_ticket_purchase) { create(:ticket_purchase, conference: conference, user: user, ticket: registration_ticket, quantity: 1) }
|
||||
let(:physical_ticket) { create(:physical_ticket, ticket_purchase: paid_ticket_purchase) }
|
||||
|
||||
context 'logged in as user with no role' do
|
||||
|
|
|
|||
5
spec/factories/ticket_scanning.rb
Normal file
5
spec/factories/ticket_scanning.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
FactoryGirl.define do
|
||||
factory :ticket_scanning do
|
||||
physical_ticket
|
||||
end
|
||||
end
|
||||
20
spec/models/ticket_scanning_spec.rb
Normal file
20
spec/models/ticket_scanning_spec.rb
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe TicketScanning do
|
||||
let(:conference) { create(:conference) }
|
||||
let(:user) { create(:user) }
|
||||
let(:registration) { create(:registration, conference: conference, user: user) }
|
||||
let(:registration_ticket) { create(:registration_ticket, conference: conference) }
|
||||
let(:paid_ticket_purchase) { create(:ticket_purchase, conference: conference, user: user, ticket: registration_ticket, quantity: 1) }
|
||||
let(:physical_ticket) { create(:physical_ticket, ticket_purchase: paid_ticket_purchase) }
|
||||
let(:ticket_scanning) { create(:ticket_scanning, physical_ticket: physical_ticket) }
|
||||
|
||||
describe 'before_create' do
|
||||
it 'marks user as present' do
|
||||
expect(registration.attended).to eq(false)
|
||||
ticket_scanning
|
||||
registration.reload
|
||||
expect(registration.attended).to eq(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue