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

T557 seeding dev data #563

Merged
merged 7 commits into from
Aug 29, 2024
Merged

T557 seeding dev data #563

merged 7 commits into from
Aug 29, 2024

Conversation

alepbloyd
Copy link
Contributor

@alepbloyd alepbloyd commented Aug 13, 2024

Will close #557

This PR:

  • Adds factory files from the Hyrax repository for use in testing and seeding of development data.
  • Adds fixture files from the Hyrax repository that are used in seeding works.
  • Updates several tests to work with the fixtures and factories taken from Hyrax.
  • Updates the seeds.rb file to:
    • Not work in production, should only be used for development. Use the prep_new_prod rake task if you need to set up a new production environment, which does not seed with demo works.
    • Create the default admin set and an "ETDs" admin set.
    • Adds five basic collections.
    • Adds works with specific file/nesting conditions, though they are private and you must log in as the admin user to see them (password for FactoryBot generated users is password).
    • Adds five public GwWorks with metadata filled in, should be viewable without logging in, and adds them to Collection Title 1.
    • Adds five public GwJournalIssues
    • Adds five public GwEtds

There might (probably) be a cleaner way of importing the factories and fixtures from Hyrax, but the location of these files in their repository has changed recently, and we are on a different version than their most up-to-date - so simplest/most stable solution right now was to just directly copy from their repository and make tweaks where needed. Definitely open to feedback or other ideas for handling this.

To test:

  • In your development environment, drop, recreate, and migrate the development database (rails db:drop followed by rails db:create followed by rails db:migrate).
  • Run rails db:seed, which may take 2-3 minutes to run. Ensure there are no errors.
  • Start development server rails s and ensure that the created works are visible, and you are able to log in as any of the users created in the seeds file.

@alepbloyd alepbloyd requested a review from dolsysmith August 13, 2024 19:11
@alepbloyd alepbloyd marked this pull request as draft August 14, 2024 01:00
@dolsysmith
Copy link
Contributor

Are you able to edit one of the seeded works in the UI? I tried editing one and I get the following error:

 ActionView::Template::Error (undefined method `access_grants' for nil:NilClass):
<% permission_service = Hyrax::EditPermissionsService.build_service_object_from(form: f, ability: current_ability) %>

Which I believe is what I was seeing before, when trying to write a spec test for editing a work.

@dolsysmith
Copy link
Contributor

I think I fixed the issue by associating a permission template with the admin set that holds the works. I was trying to follow the logic here.

@alepbloyd
Copy link
Contributor Author

Just made a few more changes to this to incorporate ETDs, Journal Issues, and adding works to a collection, so I think it should be all set for testing once CI process finishes.

@maxturer - Particularly would be interested in if there's anything else that would be beneficial to include from like a front-end styling standpoint. This should have a few collections, a few works within a collection, public works with metadata, but happy to add anything else to this that you think would be helpful.

@alepbloyd alepbloyd marked this pull request as ready for review August 16, 2024 18:50
@alepbloyd alepbloyd requested a review from maxturer August 16, 2024 18:50
Copy link
Contributor

@maxturer maxturer left a comment

Choose a reason for hiding this comment

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

Yes, this is more than enough! I can log in as the seeded users and the fine Professor Goodtests has submitted plenty of work for front end development.

@maxturer
Copy link
Contributor

The only thing that could be hjelpful going forward might be some files associated with the works, but we've already done a lot of front end work on that at this point.
missing file notifications

@alepbloyd
Copy link
Contributor Author

@maxturer - Cool, thanks for taking a look! There's a way to use like the "attach-files-to-work-job" (I forget the exact syntax) to actually attach files to works in seeding, but it ends up taking significantly longer as the files are processed.

If you're working on something where it'd be significantly beneficial to have that, lemme know and I'll show you how to manually add that step to the seeds.rb file, but I'm cool with leaving it off of this PR if you are.

@maxturer
Copy link
Contributor

Absolutely also cool with leaving that out, I think we've solved enough front end issues with the file list that we won't need to look at it for a while.

@alepbloyd alepbloyd merged commit 69d518f into master Aug 29, 2024
1 check passed
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.

Standardize development/seeding data set
3 participants