New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added the states column in the participants view #92
Conversation
d9d755b
to
e7fc87a
Compare
e7fc87a
to
e756d37
Compare
e756d37
to
587dec5
Compare
@@ -16,4 +16,19 @@ def users_for_event(state) | |||
requests = requests.where(state: state) if state != 'all' | |||
requests.distinct.pluck('users.email') | |||
end | |||
|
|||
def state_label(state) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just return the css class and do the rest in the view because it is always the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -10,7 +10,7 @@ def participants | |||
{ label: @event.name, url: event_path(@event) }, | |||
{ label: 'participants' } | |||
] | |||
@requests = @event.travel_sponsorships.includes(:user).select(:user_id).distinct.accessible_by(current_ability) | |||
@requests = @event.travel_sponsorships.includes(:user).group(:user_id).accessible_by(current_ability) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the previous query we are only selecting the user_id from a request for distinct requests if we also select state here then the requests will not be distinct, also group returns the latest request of the user(active request) I don't know if distinct also do the same.
587dec5
to
2e76ce8
Compare
app/helpers/events_helper.rb
Outdated
def state_label(state) | ||
case state | ||
when 'submitted' | ||
'label label-primary' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
label could also go to the view
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes ok :)
2e76ce8
to
2f2fc0c
Compare
A person can only have a single active request for an event. The State column shows the state of the active request of a user.