-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Deprecate answers model #11308
Deprecate answers model #11308
Conversation
@@ -90,8 +90,7 @@ def recently_commented | |||
.where(status: 1) | |||
@pagy, @questions = pagy(filter_questions_by_tag(@questions, params[:tagnames]) | |||
.joins(:comments) | |||
.order('comments.timestamp DESC') | |||
.group('node.nid'), items: 24) |
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 have removed the group
function from here for two reasons:
- The
@questions
we are filtering on are already being grouped bynode.nid
. - The MySQL issue that is coming up was that ordering was happening on a variable on which grouping is not happening.
I believe that because of this, the behaviour of the code should not change, and we should get the same results.
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 think we are doing this to order it by the comment timestamps, but because nodes can have multiple comments, we had been seeing them appear more than once, so we re-added the group to ensure each node appears only once. But if you can confirm for sure that the duplication isn't happening, I like a simpler query!
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.
Hmm...on the data that I have I'm unable to see any duplication, but I think it is safer to keep it in that way then. I'll revert this change, thanks!
Codecov Report
@@ Coverage Diff @@
## main #11308 +/- ##
==========================================
+ Coverage 82.33% 82.46% +0.12%
==========================================
Files 98 97 -1
Lines 5996 5972 -24
==========================================
- Hits 4937 4925 -12
+ Misses 1059 1047 -12
|
Also commenting so that there is a track on the planning issue. |
Hmm, I notice (nearly) all of the tests have failed. Interesting. Let me check what precisely the logs are, |
Looks like it is a CodeCov issue?
@jywarren could you help me out here, please? Thanks! |
So strange. But CodeCove does get flaky sometimes. I'll try restarting it? |
Ah wait, i now see this error:
|
I think we need to continue searching for where we depend on answers code! I mean, there are a lot: https://github.com/publiclab/plots2/search?q=answers |
If you're not sure what to do in one of these places, feel free to leave a comment at the end of the line, and I can make a code suggestion inline in this PR! |
@@ -90,8 +90,7 @@ def recently_commented | |||
.where(status: 1) | |||
@pagy, @questions = pagy(filter_questions_by_tag(@questions, params[:tagnames]) | |||
.joins(:comments) | |||
.order('comments.timestamp DESC') | |||
.group('node.nid'), items: 24) |
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 think we are doing this to order it by the comment timestamps, but because nodes can have multiple comments, we had been seeing them appear more than once, so we re-added the group to ensure each node appears only once. But if you can confirm for sure that the duplication isn't happening, I like a simpler query!
app/views/home/home.html.erb
Outdated
@@ -126,6 +125,6 @@ | |||
</style> | |||
|
|||
<% cache('feature_home-footer', skip_digest: true) do %> | |||
<%= feature("home-footer") %> |
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.
Hi, was this done incorrectly somehow? It might just be a feature we're not currently using. I think footer-notice is the topics table, so it might display twice if we add it here? But I could be wrong.
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.
Can you confirm this? Then I think we are ready to merge, thanks!
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.
Hey! So in the older home.html.erb
, this is there so I haven't changed it yet. Would you like me to remove this?
Reference:
plots2/app/views/home/home.html.erb
Lines 128 to 130 in 5aa8720
<% cache('feature_home-footer', skip_digest: true) do %> | |
<%= feature("home-footer") %> | |
<% end %> |
@@ -0,0 +1,5 @@ | |||
class DropAnswers < ActiveRecord::Migration[5.2] | |||
def change | |||
drop_table :answers |
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.
yay!
This pull request generated screenshots of many common pages in the running app. You should be able to download and view them here: |
Code Climate has analyzed commit 2f6e6a6 and detected 0 issues on this pull request. View more on Code Climate. |
This pull request generated screenshots of many common pages in the running app. You should be able to download and view them here: |
All tests passing!! 🥳 🎉 |
@@ -11,7 +11,7 @@ def setup | |||
|
|||
get :home | |||
assert_response :success | |||
assert_select "title", Sanitize.clean('🎈') + (" Public Lab: #{title}") | |||
assert_select "title", Sanitize.clean('🎈') + (" Public Lab: #{title}") # Test failing here |
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.
Oops just need to remove this comment!
@@ -484,7 +484,7 @@ def teardown | |||
|
|||
assert_response :success | |||
assert_template :index | |||
assert_select "title", Sanitize.clean('🎈') + (" Public Lab: Popular wiki pages") | |||
assert_select "title", Sanitize.clean('🎈') + (" Public Lab: Popular wiki pages") # Test failing here |
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 too!
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.
all good except 2 comments! Great work!
@@ -1,7 +1,6 @@ | |||
<% cache('feature_home-intro', skip_digest: true) do %> | |||
<%= feature("home-intro") %> | |||
<% end %> | |||
|
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.
Ah i see in the final diff nothing has changed. Thank you, just checking! Merging!
Great work, a big PR!!! |
Fixes #956
Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!
rake test
@publiclab/reviewers
for help, in a comment below