Code Monkey home page Code Monkey logo

Comments (6)

dancristianb avatar dancristianb commented on July 18, 2024 1

Hi @markets ! Nice catch, thanks for reporting 🙏 I'm jumping in as I think this might be related to some of the updates I helped push out in #4544

I've checked the gems page and it looks like the latest invisible_captcha version seems to be reported correctly there see https://rubygems.org/gems?letter=I&page=94

Screenshot 2024-04-19 at 12 54 07

We use different queries to load the gems on the profile page and gems page

  • For the gems page we use the #latest_version
  • For the profiles page we use the #most_recent_version and strict_loading

I've pulled the gems locally and switched to using the #latest_version and strict_loading on the profiles page as well and we now seem to render the correct "latest" version. I'm not sure of any other side effects though 😀 The diff looks something like this:

diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb
index 82a3c1a2d..1adbf2338 100644
--- a/app/controllers/profiles_controller.rb
+++ b/app/controllers/profiles_controller.rb
@@ -9,7 +9,7 @@ class ProfilesController < ApplicationController

   def show
     @user = User.find_by_slug!(params[:id])
-    @rubygems = @user.rubygems_downloaded.includes(%i[most_recent_version gem_download]).strict_loading
+    @rubygems = @user.rubygems_downloaded.includes(%i[latest_version gem_download]).strict_loading
   end

   def me
diff --git a/app/views/profiles/_rubygem.html.erb b/app/views/profiles/_rubygem.html.erb
index c8fa121d2..3fa8e2582 100644
--- a/app/views/profiles/_rubygem.html.erb
+++ b/app/views/profiles/_rubygem.html.erb
@@ -3,7 +3,7 @@
     <span class="gems__gem__info">
       <a href="<%= rubygem_path(rubygem.slug) %>" class="gems__gem__name">
         <%= rubygem.name %>
-        <span class="gems__gem__version"><%= rubygem.most_recent_version %></span>
+        <span class="gems__gem__version"><%= rubygem.latest_version %></span>
       </a>
     </span>
     <p class="gems__gem__downloads__count">

So this is what I see locally without the above diff applied

Screenshot 2024-04-19 at 13 07 43

This is what the page looks like with the above diff applied

Screenshot 2024-04-19 at 13 02 30

Prosopite doesn't seem to report any n+1s ✅ I'm not sure why we're not using the #latest_version there 🤔

from rubygems.org.

markets avatar markets commented on July 18, 2024 1

Definitely that's a bug, it's really strange to not display latest version in profile pages.

For example, visiting DHH profile, you can also see different versions for the different Rails core gems:

Captura de pantalla 2024-04-19 a las 19 28 52

It would be really nice to fix this.

from rubygems.org.

dancristianb avatar dancristianb commented on July 18, 2024 1

It is most likely a bug. I think it used to always show the latest release of a given gem in the past; at the least I think it used to be that way.

Definitely that's a bug, it's really strange to not display latest version in profile pages.

+1

unfortunately I'm not familiar with this app, so I don't know if that is 100% correct or it has any side effect.

Same here, barely scratching the surface 😀 I'll draft a PR so we can see if the updates don't break anything else and hopefully we'll get the ball rolling with this one 😀

from rubygems.org.

markets avatar markets commented on July 18, 2024

Tracking down the code, I think the related line is the following:

<span class="gems__gem__version"><%= rubygem.most_recent_version %></span>

So, apparently this most_recent_version method doesn't work as expected?

has_one :most_recent_version,
lambda {
order(Arel.sql("case when #{quoted_table_name}.latest AND #{quoted_table_name}.platform = 'ruby' then 2 else 1 end desc"))
.order(Arel.sql("case when #{quoted_table_name}.latest then #{quoted_table_name}.number else NULL end desc"))
.order(id: :desc)
},
class_name: "Version", inverse_of: :rubygem

from rubygems.org.

markets avatar markets commented on July 18, 2024

Thanks for looking into this @dancristianb! Yes, that seems a good fix, but unfortunately I'm not familiar with this app, so I don't know if that is 100% correct or it has any side effect.

from rubygems.org.

rubyFeedback avatar rubyFeedback commented on July 18, 2024

It is most likely a bug. I think it used to always show the latest release of a given gem in the past; at the least I think it used to be that way.

(Note that conceptually I am not sure what the difference should be between .most_recent_version and .latest_version; just the names itself may lead to confusion. IMO .most_recent_version seems more clear, or one could make it even more verbose, e. g. .most_recently_published_version - but I could not tell what the difference to .latest_version would be. It may be easier to use only one name here, in the event this could otherwise lead to confusion.)

from rubygems.org.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.