Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
Activity: Remove 'ongoing' attribute.
Browse files Browse the repository at this point in the history
Users wish to specify activities in terms of start date to end date, and start time and end time.
In the case of one-time events, the start and end dates will be the same. There is need to
additionally distinguish multi-day/ongoing vs single-day/'one-time' activities.

Remove the field.

References #49.
  • Loading branch information
ybakos committed Sep 4, 2020
1 parent 1dd5090 commit 9993f03
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/controllers/activities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def set_activity
def activity_params
params.require(:activity).permit(:title, :start_date, :end_date, :start_time, :end_time,
:description, :location, :contact_name, :contact_number,
:contact_email, :state, :ongoing, :organization_name, :tag_list,
:contact_email, :state, :organization_name, :tag_list,
:url
)
end
Expand Down
3 changes: 1 addition & 2 deletions app/javascript/components/model_card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
</h3>
<div v-if="modelDisplayAttributes">
<div v-for="entry in Object.entries(modelDisplayAttributes)">
<p class="model-detail" v-if="model['ongoing'] && entry[0] == 'start_date'">Time: Ongoing</p>
<p class="model-detail" v-else-if="model[entry[0]]">{{ format(model[entry[0]]) }}</p>
<p class="model-detail">{{ format(model[entry[0]]) }}</p>
</div>
</div>
<span class="tag badge badge-pill mr-1" v-for="tag in model.tag_list">{{ tag }}</span>
Expand Down
2 changes: 0 additions & 2 deletions app/views/activities/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
%dd.col-9= @activity.description
%dt.col-3 Location
%dd.col-9= @activity.location
%dt.col-3 Frequency
%dd.col-9= @activity.ongoing? ? 'Ongoing' : 'One Time'
%dt.col-3 Dates
%dd.col-9
%p
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20200904071039_remove_ongoing_from_activity.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RemoveOngoingFromActivity < ActiveRecord::Migration[5.2]
def change
remove_column :activities, :ongoing
end
end
3 changes: 1 addition & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2020_09_04_065156) do
ActiveRecord::Schema.define(version: 2020_09_04_071039) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -44,7 +44,6 @@
t.string "contact_number"
t.string "contact_email"
t.integer "state"
t.boolean "ongoing"
t.string "organization_name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
Expand Down
4 changes: 2 additions & 2 deletions spec/factories/activities.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
FactoryBot.define do
factory :activity do
location { 'Bend' }
title { 'Lettuce Taco Bout It FUNdraiser' }
start_date { '01/01/2020' }
end_date { '01/11/2020' }
start_time { '10:00' }
end_time { '12:00' }
location { 'Bend' }
contact_name { 'Howard' }
contact_email { '[email protected]' }
contact_number { '123-456-7890' }
organization_name { 'Taco Tuesday' }
description { "Come support 'Lettuce Taco Bout It' at this FUNdraiser" }
title { 'Lettuce Taco Bout It FUNdraiser' }
end

factory :invalid_activity, parent: :activity do |activity|
Expand Down
3 changes: 1 addition & 2 deletions spec/models/activity_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

RSpec.describe User, type: :model do
RSpec.describe Activity, type: :model do
let(:activity) { build(:activity) }

describe 'attributes' do
Expand All @@ -15,7 +15,6 @@
specify { expect(activity).to respond_to(:contact_number) }
specify { expect(activity).to respond_to(:contact_email) }
specify { expect(activity).to respond_to(:state) }
specify { expect(activity).to respond_to(:ongoing) }
specify { expect(activity).to respond_to(:organization_name) }
specify { expect(activity).to respond_to(:url) }
end
Expand Down

0 comments on commit 9993f03

Please sign in to comment.