-
-
Notifications
You must be signed in to change notification settings - Fork 525
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
4174 Add Last Distribution Date column on the Organization view for Super Admin user. #4207
4174 Add Last Distribution Date column on the Organization view for Super Admin user. #4207
Conversation
… model to display in the _list.html.erb view for the Superadmin role.
Removing |
@@ -264,6 +264,11 @@ def earliest_reporting_year | |||
year | |||
end | |||
|
|||
def last_distribution_date | |||
distribution = distributions.order(issued_at: :desc).first |
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.
I would call this display_last_distribution_date rather than last_distribution_date. Naming it last_distribution_date implies that it is a date, to me, anyway.
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.
Sounds good to me. I've made this change and have pushed up the changes.
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.
The functionality works great! @dorner - do you have any concerns about the code?
it { expect(response).to be_successful } | ||
|
||
it 'organization details' do | ||
expect(assigns(:organization)).to have_attributes( |
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.
I don't see this spec as super helpful - you're diving way deep into the weeds of implementation. I'd rather look at the rendered text and verify that the value you expect to see is there. In this case you should use travel_to
to lock in the date and time, update the organization to have specified values, and then expect those values to be in the output.
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 I will take a look at this again. Sorry, I have not forgotten about this. I just got a new Macbook and am still in the process of getting things up and running!
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.
@dorner Starting to take a look at this now and trying to wrap my head around your suggestion. Sorry, I'm still relatively newer and still learning a lot. Do you know if there is something similar or an example I can look at?
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.
Here's an example of the traveling:
travel_to Time.zone.local(2019, 6, 30) |
and here's how you can check the rendered text:
expect(response.body).to include("John Doe") |
You can get more nitty-gritty by actually turning the text into DOM and checking it specifically:
expect(page.css(".deactivate-kit-button")).not_to be_empty |
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.
I'm not sure we actually need to travel-to to test this out -- we're looking at the issued_at, rather than the created_at for the last distribution date, and that is "manually" set. Or am I missing something?
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.
I've kind of been struggling with how to use travel_to
with the issued_at
myself...
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.
My bad - as usual @cielf is right 😃
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.
So can I resolve this conversation and we're good to go with this change?
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.
No - it's still an issue IMO. You shouldn't be looking at assigns
- it's better to look at the rendered text.
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.
This took waaaay longer than I had hoped and expected. I think I figured it out though and, of course, it seems to be way simpler than I had made it out to be.
Sorry, that it took so long.... still learning over here 🙃
Nice, thanks! |
@pshong79: Your PR |
Resolves #4174
Description
This change adds the
Last Distribution Date
to the Organization view for the Super Admin user.Type of change
How Has This Been Tested?
organization_requests_spec.rb
file to verify all the data returned for an organization, including thelast_distribution_date
Screenshots
Before:

After:
