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

Convert map nodes to note nodes #11225

Merged

Conversation

anirudhprabhakaran3
Copy link
Member

@anirudhprabhakaran3 anirudhprabhakaran3 commented Jun 25, 2022

Fixes #4072

This MR aims to convert all map nodes into note nodes. It consists of a db migration, which can be run using rails db:migrate to be run. The script does the following:

  1. Get the necessary values and data and add it to the revision body in the form of HTML
  2. Update the type of node to note
  3. Create a new path for the node to reflect its new type, using generate_path

Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!

  • PR is descriptively titled 📑 and links the original issue above 🔗
  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with rake test
  • code is in uniquely-named feature branch and has no merge conflicts 📁
  • screenshots/GIFs are attached 📎 in case of UI updation
  • ask @publiclab/reviewers for help, in a comment below

Screenshots

This is the console output before running the migration.

Screenshot from 2022-06-25 20-09-06

We can see that before the migration, it is being rendered as a map. We can see that from the URL as well.

Screenshot from 2022-06-25 20-11-08

After running the migration, we note that all the maps have been converted to notes:

Screenshot from 2022-06-25 20-12-46

It is also reflected when we go to the notes page:

Screenshot from 2022-06-25 20-13-10

Individually, we can see the map in the note template.

Screenshot from 2022-06-25 20-13-37

@anirudhprabhakaran3 anirudhprabhakaran3 requested a review from a team as a code owner June 25, 2022 14:53
@gitpod-io
Copy link

gitpod-io bot commented Jun 25, 2022

@anirudhprabhakaran3 anirudhprabhakaran3 self-assigned this Jun 25, 2022
@anirudhprabhakaran3
Copy link
Member Author

Also, part of the bigger deprecation effort being tracked at #11185

(Added the comment so that MR shows up there too. This comment can be ignored)

@github-actions
Copy link

This pull request generated screenshots of many common pages in the running app. You should be able to download and view them here:
https://github.com/publiclab/plots2/suites/7090041000/artifacts/280358891

@github-actions
Copy link

This pull request generated screenshots of many common pages in the running app. You should be able to download and view them here:
https://github.com/publiclab/plots2/suites/7090042426/artifacts/280359273

revision.body += map_details
revision.body += old_body
revision.body += notes
revision.body += cartographer_notes
Copy link
Collaborator

Choose a reason for hiding this comment

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

Love this arrangement ❤️

db/migrate/20220625142729_convert_map_to_note_nodes.rb Outdated Show resolved Hide resolved
@github-actions
Copy link

This pull request generated screenshots of many common pages in the running app. You should be able to download and view them here:
https://github.com/publiclab/plots2/suites/7120867623/artifacts/282467311

@jywarren
Copy link
Member

jywarren commented Jul 2, 2022

Hi @anirudhprabhakaran3 i'll be offline for 2 days but let me or Tilda or Cess know when this needs another review or when it's ready! Thanks!

@github-actions
Copy link

github-actions bot commented Jul 4, 2022

This pull request generated screenshots of many common pages in the running app. You should be able to download and view them here:
https://github.com/publiclab/plots2/suites/7202928394/artifacts/288131820

@anirudhprabhakaran3
Copy link
Member Author

The migration is working succssfully on the unstable server!
https://jenkins.laboratoriopublico.org/job/Plots-Unstable/lastBuild/console

However, the build is not completing because of another error in the Uglifier gem,

@github-actions
Copy link

github-actions bot commented Jul 4, 2022

This pull request generated screenshots of many common pages in the running app. You should be able to download and view them here:
https://github.com/publiclab/plots2/suites/7202928394/artifacts/288180196

@codeclimate
Copy link

codeclimate bot commented Jul 4, 2022

Code Climate has analyzed commit 10010fb and detected 0 issues on this pull request.

View more on Code Climate.

@github-actions
Copy link

github-actions bot commented Jul 4, 2022

This pull request generated screenshots of many common pages in the running app. You should be able to download and view them here:
https://github.com/publiclab/plots2/suites/7211071817/artifacts/288659874

@jywarren jywarren merged commit 121c8cd into publiclab:main Jul 5, 2022
@jywarren
Copy link
Member

jywarren commented Jul 5, 2022

@anirudhprabhakaran3 can you check that this seems to be working OK on stable before we push it to production? Thanks!

@anirudhprabhakaran3
Copy link
Member Author

Hi! Yeah, I'll try to check that. On my local laptop, I used to just run Node.where(type: 'map').count to see if it was a success. On the browser, I'll have to figure out a way to find map nodes.

If you have access to the console to stable, could you run that maybe once and get the count? Thank you!

jywarren added a commit that referenced this pull request Sep 13, 2022
jywarren added a commit that referenced this pull request Oct 5, 2022
* remove map files post #11225

* routes

* test removals

* test tweaks

* fix bob node

* test fix

* routes and test fixes

* reworked map-style path routing, handling in notes_controller, cleanout map_controller

* fix functional tests

* routes order change

* Update test/functional/notes_controller_test.rb

* Update test/functional/notes_controller_test.rb
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.

Begin converting Map nodes into normal note nodes
3 participants