diff --git a/.github/workflows/spec.yml b/.github/workflows/spec.yml index ed871fe2f..35420e4ca 100644 --- a/.github/workflows/spec.yml +++ b/.github/workflows/spec.yml @@ -83,3 +83,10 @@ jobs: # $CCTR sum-coverage coverage/codeclimate.*.json # $CCTR upload-coverage --id "6d21ff1a59b134f3741779d50325f7bd5183cbe6b205051573d955705148960f" # $CCTR after-build --id "6d21ff1a59b134f3741779d50325f7bd5183cbe6b205051573d955705148960f" + - name: Upload coverage to Codecov + if: always() + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage/coverage.xml + flags: ${{ matrix.suite }} diff --git a/README.md b/README.md index f8805568f..035fd8cdc 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,16 @@ -## Srping 2024 CS169L +# [Snap!Con](https://snapcon.org) Base Repository [![Specs](https://github.com/snap-cloud/snapcon/actions/workflows/spec.yml/badge.svg)](https://github.com/snap-cloud/snapcon/actions/workflows/spec.yml) -[![Pivotal Tracker](doc/pivotal_tracker_logo.png)](https://www.pivotaltracker.com/n/projects/2487653) -[![Maintainability](https://api.codeclimate.com/v1/badges/b7b0d559a03bf218663a/maintainability)](https://codeclimate.com/github/snap-cloud/snapcon/maintainability) -[![Test Coverage](https://api.codeclimate.com/v1/badges/b7b0d559a03bf218663a/test_coverage)](https://codeclimate.com/github/snap-cloud/snapcon/test_coverage) +[![Maintainability](https://qlty.sh/gh/snap-cloud/projects/snapcon/maintainability.svg)](https://qlty.sh/gh/snap-cloud/projects/snapcon) +[![Code Coverage](https://qlty.sh/gh/snap-cloud/projects/snapcon/coverage.svg)](https://qlty.sh/gh/snap-cloud/projects/snapcon) [![codecov](https://codecov.io/gh/snap-cloud/snapcon/branch/snapcon/graph/badge.svg?token=EViEwaSjH4)](https://codecov.io/gh/snap-cloud/snapcon) Deploy -# [Snap!Con](https://snapcon.org) +## Spring 2026 CS169L Repository +[![Specs](https://github.com/cs169/snapcon/actions/workflows/spec.yml/badge.svg)](https://github.com/cs169/snapcon/actions/workflows/spec.yml) +[![codecov](https://codecov.io/gh/cs169/snapcon/graph/badge.svg?token=kw6lq9NkSW)](https://codecov.io/gh/cs169/snapcon) + Forked From: ## Open Source Event Manager - [osem.io](https://osem.io) diff --git a/app/controllers/schedules_controller.rb b/app/controllers/schedules_controller.rb index 0a6f121fb..2f77e5b76 100644 --- a/app/controllers/schedules_controller.rb +++ b/app/controllers/schedules_controller.rb @@ -14,7 +14,7 @@ def show event_schedules = @program.event_schedule_for_fullcalendar unless event_schedules - redirect_to events_conference_schedule_path(@conference.short_title) + redirect_to events_conference_schedule_path(@conference.short_title, favourites: @favourites.presence) return end @@ -80,6 +80,10 @@ def happening_now event_ids = @events_schedules.map { |es| es.event.id } favourited_events(event_ids) + if current_user && @favourites + @events_schedules.keep_if { |es| es.event.planned_for_user?(current_user) } + end + respond_to do |format| format.html format.json { render json: @events_schedules.to_json(root: false, include: :event) } @@ -87,7 +91,7 @@ def happening_now end def vertical_schedule - redirect_to conference_schedule_path(@conference) + redirect_to conference_schedule_path(@conference, favourites: @favourites.presence) end def app diff --git a/app/views/admin/tickets/_form.html.haml b/app/views/admin/tickets/_form.html.haml index 30a4e4418..b64cb7c35 100644 --- a/app/views/admin/tickets/_form.html.haml +++ b/app/views/admin/tickets/_form.html.haml @@ -22,7 +22,7 @@ = render partial: 'shared/help', locals: { id: 'accepted_help', show_event_variables: true, show_ticket_variables: true} .form-group = f.label :price - = f.number_field :price, class: 'form-control' + = f.number_field :price, class: 'form-control', value: f.object.price.to_f, step: 0.01, min: 0 - if Ticket.where(conference: @conference).empty? .form-group = f.label :price_currency, 'Currency' diff --git a/app/views/schedules/_schedule_tabs.html.haml b/app/views/schedules/_schedule_tabs.html.haml index 198ea74c4..654a8eaed 100644 --- a/app/views/schedules/_schedule_tabs.html.haml +++ b/app/views/schedules/_schedule_tabs.html.haml @@ -3,7 +3,7 @@ %li.program{ class: ('active' if active == 'program'), role: 'presentation' } = link_to('All events', events_conference_schedule_path(@conference.short_title, favourites: @favourites)) %li.program{ class: ('active' if active == 'now'), role: 'presentation' } - = link_to('Happening Now', happening_now_conference_schedule_path(@conference.short_title)) + = link_to('Happening Now', happening_now_conference_schedule_path(@conference.short_title, favourites: @favourites)) %li.schedule{ class: ('active' if active == 'vertical_schedule'), role: 'presentation' } = link_to('Schedule', vertical_schedule_conference_schedule_path(@conference.short_title, favourites: @favourites)) .pull-right diff --git a/spec/controllers/schedules_controller_spec.rb b/spec/controllers/schedules_controller_spec.rb index cc58a89da..6f3ba047d 100644 --- a/spec/controllers/schedules_controller_spec.rb +++ b/spec/controllers/schedules_controller_spec.rb @@ -91,6 +91,36 @@ expect(response.body).to include('code') end end + + context 'with favourites parameter' do + let(:user) { create(:user) } + let!(:scheduled_event3) do + create(:event, program: program, state: 'confirmed') + end + let!(:event_schedule3) do + create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, + start_time: Time.now.in_time_zone(conference2.timezone).strftime('%a, %d %b %Y %H:%M:%S')) + end + + before do + sign_in user + scheduled_event1.favourite_users << user + end + + it 'shows only favourited events when favourites=true' do + get :happening_now, params: { conference_id: conference2.short_title, favourites: 'true' } + events = assigns(:events_schedules).map(&:event) + expect(events).to include(scheduled_event1) + expect(events).not_to include(scheduled_event3) + end + + it 'shows all happening events when favourites is not set' do + get :happening_now, params: { conference_id: conference2.short_title } + events = assigns(:events_schedules).map(&:event) + expect(events).to include(scheduled_event1) + expect(events).to include(scheduled_event3) + end + end end describe 'GET #vertical_schedule' do @@ -105,5 +135,17 @@ expect(response).to have_http_status(:found) end end + + context 'preserves favourites parameter' do + it 'includes favourites=true in redirect when set' do + get :vertical_schedule, params: { conference_id: conference.short_title, favourites: 'true' } + expect(response).to redirect_to(conference_schedule_path(conference, favourites: true)) + end + + it 'does not include favourites in redirect when not set' do + get :vertical_schedule, params: { conference_id: conference.short_title } + expect(response).to redirect_to(conference_schedule_path(conference)) + end + end end end