Plots2: Remove references to "place" and "tool" node types

Created on 21 Aug 2016  Â·  21Comments  Â·  Source: publiclab/plots2

These are now completely gone from the database, and we can remove that code. All those types have been converted to "page" and we can just use "page" in those queries now.

There are instances in a few places, including:

https://github.com/publiclab/plots2/blob/master/app/controllers/wiki_controller.rb#L267

for example. Other file that include these are:

https://github.com/publiclab/plots2/blob/master/app/controllers/notes_controller
https://github.com/publiclab/plots2/blob/master/app/controllers/tag_controller

https://github.com/publiclab/plots2/blob/master/app/models/drupal_node.rb
https://github.com/publiclab/plots2/blob/master/app/models/drupal_users.rb
https://github.com/publiclab/plots2/blob/master/app/models/drupal_tag.rb

There may be more instances as well. But there are none in the fixtures, so in removing all these, tests should still pass.

Ruby enhancement help wanted

All 21 comments

@jywarren I can take this one. Just so I understand what you want, the original line is:

.where("node_revisions.status = 1 AND node.status = 1 AND (type = 'page' OR type = 'tool' OR type = 'place')")

and the final product should be:

.where("node_revisions.status = 1 AND node.status = 1 AND type = 'page")

for all instances where place and tool node types occur?

Yes -- that's right! And note to self that we'll have to triple-check that
all tool and place pages have been converted over before merging this.
Thanks!

On Wed, Sep 21, 2016 at 2:35 PM, Nick Staggs [email protected]
wrote:

@jywarren https://github.com/jywarren I can take this one. Just so I
understand what you want, the original line is:

.where("node_revisions.status = 1 AND node.status = 1 AND (type = 'page' OR type = 'tool' OR type = 'place')")

and the final product should be:

.where("node_revisions.status = 1 AND node.status = 1 AND type = 'page")

for all instances where place and tool node types occur?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/714#issuecomment-248702546,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABfJ_wgoMEBuyDCNY0mkShKWGphNX8Nks5qsXj9gaJpZM4JpLpI
.

@jywarren could you assign this to me?

Absolutely -- done! Thanks!!

Hi, just checking if you've gotten stuck on this at all, or if I could help in any way? Thanks!

@jywarren is this issue solved?

Yes, it can!

@jywarren can I work on this issue?

@jywarren can I work on this issue?

@jywarren can u assign this to me?

We'd love your help -- no need to assign, and sorry for the slow reply!

On Sat, Nov 9, 2019 at 5:07 AM Swathi Kasikala notifications@github.com
wrote:

@jywarren https://github.com/jywarren can I work on this issue?

@jywarren https://github.com/jywarren can u assign this to me?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/714?email_source=notifications&email_token=AAAF6J2DNLDTAM3SEC4JOG3QS2DSZA5CNFSM4CNEXJEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDUCNYI#issuecomment-552085217,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAF6J52DYEIEMEVM7MQ3G3QS2DSZANCNFSM4CNEXJEA
.

UPDATE

The file links currently that still have this references are:

https://github.com/publiclab/plots2/blob/main/app/controllers/wiki_controller.rb
https://github.com/publiclab/plots2/blob/main/app/controllers/notes_controller.rb
https://github.com/publiclab/plots2/blob/main/app/models/node.rb
https://github.com/publiclab/plots2/blob/main/app/services/search_service.rb
e.g
https://github.com/publiclab/plots2/blob/main/app/controllers/wiki_controller.rb#L377 would ideally be change from
.where("status = 1 AND nid != 259 AND (type = 'page' OR type = 'tool' OR type = 'place') AND cached_likes >= 0")
to
.where("status = 1 AND nid != 259 AND type = 'page' AND cached_likes >= 0")

This could potentially be broken down to to ftos or worked on as one.

please note: some tests may fail after this and that will need to be fixed with this PR...No worries if you are new to testing we are willing to help once the changes are done. thanks

@jywarren @cesswairimu should I make this into a bunch of FTOs? Or should I work on it?

Hi @anirudhprabhakaran3 , either its great and will be highly appreciated..your call. thanks

I think @KSVSC is working on this, if that's the case I'll take up some other issue!

I think @KSVSC is working on this, if that's the case I'll take up some other issue!

Yes, I am working on this. Thanks :)

@jywarren @cesswairimu @TildaDares Hi! I have opened a PR for this, kindly review it :)

UPDATE

The file links currently that still have this references are:

https://github.com/publiclab/plots2/blob/main/app/controllers/wiki_controller.rb
https://github.com/publiclab/plots2/blob/main/app/controllers/notes_controller.rb
https://github.com/publiclab/plots2/blob/main/app/models/node.rb
https://github.com/publiclab/plots2/blob/main/app/services/search_service.rb
e.g
https://github.com/publiclab/plots2/blob/main/app/controllers/wiki_controller.rb#L377 would ideally be change from
.where("status = 1 AND nid != 259 AND (type = 'page' OR type = 'tool' OR type = 'place') AND cached_likes >= 0")
to
.where("status = 1 AND nid != 259 AND type = 'page' AND cached_likes >= 0")

This could potentially be broken down to to ftos or worked on as one.

please note: some tests may fail after this and that will need to be fixed with this PR...No worries if you are new to testing we are willing to help once the changes are done. thanks

Hi, @cesswairimu. I believe that Line nos 22-28 needs to be removed too in the file https://github.com/publiclab/plots2/blob/main/app/controllers/legacy_controller.rb#L22-#L28. Please confirm and review my PR for this issue. Thanks!

Hi @KSVSC on this https://github.com/publiclab/plots2/blob/main/app/controllers/legacy_controller.rb#L22-#L28 that is fine we can leave it as is...bacuse the request already redirects to /wiki

what we would like to remove is anywhere we are filtering nodes with the type 'page' OR 'tool'.

e.g select * from nodes where type='tool' -- we shouldn't have any query that has this type of filter...what do you think?

@cesswairimu, Agreed! I made the required modifications to my PR. Thanks!

great :tada: , thanks...reviewing in a few

Was this page helpful?
0 / 5 - 0 ratings

Related issues

keshavsethi picture keshavsethi  Â·  3Comments

grvsachdeva picture grvsachdeva  Â·  3Comments

jywarren picture jywarren  Â·  3Comments

keshavsethi picture keshavsethi  Â·  3Comments

grvsachdeva picture grvsachdeva  Â·  3Comments