Skip to content
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

add index page for standup meetings #145

Merged
merged 8 commits into from
Jul 10, 2023
Merged

add index page for standup meetings #145

merged 8 commits into from
Jul 10, 2023

Conversation

afogel
Copy link
Collaborator

@afogel afogel commented Jul 9, 2023

Creates general #index page and shell for other features to be added to the StandupMeeting#index page.

Screen Shot 2023-07-09 at 6 42 37 PM

standup_meeting_group_id: params[:standup_meeting_group_id]
)
@date_options = StandupMeeting.meeting_dates(params[:standup_meeting_group_id])
if @standup_meetings.empty?
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gracefully handle the event in which a particular date requested by a user does not have any StandupMeetings that fall on that date.

Copy link
Collaborator

@toyhammered toyhammered left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if you have any questions. I'd like to keep this still very simple.

@@ -1,7 +1,23 @@
class StandupMeetingsController < ApplicationController
def index
@meeting_date = params[:date].nil? ? Date.current : Date.parse(params[:date])
@standup_meetings = StandupMeeting.includes(:user, :standup_meeting_group)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be changed to something like this:

@standup_meeting_group = StandupMeetingGroup.find(standup_meeting_group_id)
@standup_meetings = @standup_meeting_group.standup_meetings.includes(:user).where(meeting_date: @meeting_date)

The main reason is we should still go to that day even if there are no standup meetings for it. It should be treated the exact same and on the view side it will just be empty in that bottom section.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes a ton more sense to me -- kind of incredible that such a small change simplifies things so dramatically.

@@ -1,7 +1,23 @@
class StandupMeetingsController < ApplicationController
def index
@meeting_date = params[:date].nil? ? Date.current : Date.parse(params[:date])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am debating on whether this should be a required param and the routes pass it in (in like 95% of the cases they will).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it probably makes sense to keep, just in case?

meeting_date: @meeting_date,
standup_meeting_group_id: params[:standup_meeting_group_id]
)
@date_options = StandupMeeting.meeting_dates(params[:standup_meeting_group_id])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to the above, I don't think we even need this if this was only used in the redirect due to there being no meetings on that day.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used later for moving between dates in #146 as well. I introduced it here because it is also useful for the redirect guard.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need it there either. The logic should just be +1 or -1 to the current date. Let weekend pages show with no standup meetings.

Copy link
Collaborator

@toyhammered toyhammered left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one small thing to fix, but once that is done feel free to merge in.

def index?
user.admin? || matching_user?
group_member? || user.admin?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fine with this for now but this is a strange one cause of the mixing/matching of what the "record" actually is. Not sure of a good solution to make this clearer.

user.standup_meetings
end
def group_member?
record.users.where(id: user.id).present?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should just do find_by because we are looking for a single record. Technically doesn't make much of a difference just more clear.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's a boolean check for one record, I really like to reach for #exists? Rails guide for it

But then you can express this as record.users.exists?(user.id)

@afogel afogel merged commit 33d3596 into main Jul 10, 2023
1 check passed
@afogel afogel deleted the 113_part_one branch July 10, 2023 16:39
@afogel afogel linked an issue Jul 10, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Standup Epic] View Standups organized by group and date
3 participants