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

Expanding the range of followed tags we show #16213

Merged
merged 1 commit into from Jan 21, 2022
Merged

Expanding the range of followed tags we show #16213

merged 1 commit into from Jan 21, 2022

Conversation

jeremyf
Copy link
Contributor

@jeremyf jeremyf commented Jan 19, 2022

What type of PR is this? (check all applicable)

  • Bug Fix

Description

I have talked with @amywtlin about the expectations regarding the tags that one follows. This is the lightest weight fix to align with expected behavior.

The fix might be a bit of a work-around for a more general approach, but we're fighting against the magic of the points vs. explicit_points tension as defined in the Follows::UpdatePointsWorker.

That is to say, it's possible (and happens) where I have assigned an explicit_points of 1 for a tag, but the calculated points are less than 1. The calculated points are what we send forward in the AsyncInfoController (by way of the UserDecorator#cached_followed_tags method).

In DEV, I ran the following queries:

User assigned points >= 1 but calculated < 1

985,352 records

SELECT count(id)
FROM follows
WHERE followable_type = 'ActsAsTaggableOn::Tag'
  AND points < 1
  AND explicit_points >= 1;

User assigned points >= 1 but calculated >= 1

5,366,478 records

SELECT count(id)
FROM follows
WHERE followable_type = 'ActsAsTaggableOn::Tag'
  AND points >= 1
  AND explicit_points >= 1;

User assigned points >= 1 but calculated >= 0

0 records.

SELECT count(id)
FROM follows
WHERE followable_type = 'ActsAsTaggableOn::Tag'
  AND points <= 0
  AND explicit_points >= 1;

User assigned points <= 0 but calculated > 0

1,146 records

SELECT count(id)
FROM follows
WHERE followable_type = 'ActsAsTaggableOn::Tag'
  AND points > 0
  AND explicit_points <= 0;

Synthesizing that, almost 1 million tag follows of the total 6.3 million are not showing up in the user's left navigation. And 5.3 million are roughly correct.

In adjusting the logic, we're now going to have more tags showing up in the left. And just over 1,000 might now show up that would be unexpected.

Related Tickets & Documents

Closes #14937.

QA Instructions, Screenshots, Recordings

Hopefully with this change @robertandrews will see some more tags showing up.

UI accessibility concerns?

None.

Added/updated tests?

  • No.

[Forem core team only] How will this change be communicated?

  • I'm not sure how best to communicate this change and need help

The fix might be a bit of a work-around for a more general approach, but
we're fighting against the magic of the points vs. explicit_points
tension as defined in the [Follows::UpdatePointsWorker][1].

That is to say, it's possible (and happens) where I have assigned an
`explicit_points` of 1 for a tag, but the calculated `points` are less
than 1.  The calculated `points` are what we send forward in the
[AsyncInfoController][1] (by way of the
[UserDecorator#cached_followed_tags][3] method).

In DEV, I ran the following queries:

**User assigned points `>= 1` but calculated `< 1`**

985,352 records

```sql
SELECT count(id)
FROM follows
WHERE followable_type = 'ActsAsTaggableOn::Tag'
  AND points < 1
  AND explicit_points >= 1;
```

**User assigned points `>= 1` but calculated `>= 1`**

5,366,478 records

```sql
SELECT count(id)
FROM follows
WHERE followable_type = 'ActsAsTaggableOn::Tag'
  AND points >= 1
  AND explicit_points >= 1;
```

**User assigned points `>= 1` but calculated `>= 0`**

0 records.

```sql
SELECT count(id)
FROM follows
WHERE followable_type = 'ActsAsTaggableOn::Tag'
  AND points <= 0
  AND explicit_points >= 1;
```

**User assigned points `<= 0` but calculated `> 0`**

1,146 records

```sql
SELECT count(id)
FROM follows
WHERE followable_type = 'ActsAsTaggableOn::Tag'
  AND points > 0
  AND explicit_points <= 0;
```

Synthesizing that, almost 1 million tag follows of the total 6.3 million
are not showing up in the user's left navigation.  And 5.3 million are
roughly correct.

In adjusting the logic, we're now going to have more tags showing up in
the left.  And just over 1,000 might now show up that would be unexpected.

Closes #14937.

[1]:https://github.com/forem/forem/blob/c63e0b629e1edd0b7f2ce03952cf6bf552c7b8d8/app/workers/follows/update_points_worker.rb
[2]:https://github.com/forem/forem/blob/c63e0b629e1edd0b7f2ce03952cf6bf552c7b8d8/app/controllers/async_info_controller.rb#L40-L65
[3]:https://github.com/forem/forem/blob/c63e0b629e1edd0b7f2ce03952cf6bf552c7b8d8/app/decorators/user_decorator.rb#L23-L34
@jeremyf jeremyf requested review from ludwiczakpawel, amywtlin, aitchiss, a team and Ridhwana and removed request for a team January 19, 2022 17:47
@pr-triage pr-triage bot added the PR: unreviewed bot applied label for PR's with no review label Jan 19, 2022
@pr-triage pr-triage bot added PR: partially-approved bot applied label for PR's where a single reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Jan 20, 2022
@jeremyf jeremyf merged commit af2e1f0 into main Jan 21, 2022
@jeremyf jeremyf deleted the jeremyf/gh-14937 branch January 21, 2022 00:46
@pr-triage pr-triage bot added PR: merged bot applied label for PR's that are merged and removed PR: partially-approved bot applied label for PR's where a single reviewer approves changes labels Jan 21, 2022
jeremyf added a commit that referenced this pull request Jan 21, 2022
…user

* main: (36 commits)
  Stripping tags from "tags.short_summary" column (#16248)
  Add host tag in ForemStatsClient (#16237)
  Configured the repository to handle line endings (#16234)
  Removed font-awesome from the admin section (#16239)
  fix (#16244)
  remove assignment of css variable to undefined (#16243)
  Add new tag autocomplete to editor (#16025)
  Color tokens (#16107)
  ListingsToolkit refactoring (#16184)
  Expanding the range of followed tags we show (#16213)
  Let override of ToS and CoC show in onboarding (#16217)
  Bump stripe from 5.42.0 to 5.43.0 (#16233)
  Bump flipper-active_record from 0.23.0 to 0.23.1 (#16231)
  Bump flipper-ui from 0.23.0 to 0.23.1 (#16232)
  Bump flipper-active_support_cache_store from 0.23.0 to 0.23.1 (#16230)
  Bump js-routes from 2.2.0 to 2.2.1 (#16229)
  Adds suggested_tags to Onboarding section in Config (#16228)
  Constantize broadcast messages (#16219)
  app/mailers i18n (#16191)
  Remove the "Getting Started" Section from the Config (#16033)
  ...
headline-design pushed a commit to headline-design/forem-1 that referenced this pull request Mar 11, 2022
The fix might be a bit of a work-around for a more general approach, but
we're fighting against the magic of the points vs. explicit_points
tension as defined in the [Follows::UpdatePointsWorker][1].

That is to say, it's possible (and happens) where I have assigned an
`explicit_points` of 1 for a tag, but the calculated `points` are less
than 1.  The calculated `points` are what we send forward in the
[AsyncInfoController][1] (by way of the
[UserDecorator#cached_followed_tags][3] method).

In DEV, I ran the following queries:

**User assigned points `>= 1` but calculated `< 1`**

985,352 records

```sql
SELECT count(id)
FROM follows
WHERE followable_type = 'ActsAsTaggableOn::Tag'
  AND points < 1
  AND explicit_points >= 1;
```

**User assigned points `>= 1` but calculated `>= 1`**

5,366,478 records

```sql
SELECT count(id)
FROM follows
WHERE followable_type = 'ActsAsTaggableOn::Tag'
  AND points >= 1
  AND explicit_points >= 1;
```

**User assigned points `>= 1` but calculated `>= 0`**

0 records.

```sql
SELECT count(id)
FROM follows
WHERE followable_type = 'ActsAsTaggableOn::Tag'
  AND points <= 0
  AND explicit_points >= 1;
```

**User assigned points `<= 0` but calculated `> 0`**

1,146 records

```sql
SELECT count(id)
FROM follows
WHERE followable_type = 'ActsAsTaggableOn::Tag'
  AND points > 0
  AND explicit_points <= 0;
```

Synthesizing that, almost 1 million tag follows of the total 6.3 million
are not showing up in the user's left navigation.  And 5.3 million are
roughly correct.

In adjusting the logic, we're now going to have more tags showing up in
the left.  And just over 1,000 might now show up that would be unexpected.

Closes forem#14937.

[1]:https://github.com/forem/forem/blob/c63e0b629e1edd0b7f2ce03952cf6bf552c7b8d8/app/workers/follows/update_points_worker.rb
[2]:https://github.com/forem/forem/blob/c63e0b629e1edd0b7f2ce03952cf6bf552c7b8d8/app/controllers/async_info_controller.rb#L40-L65
[3]:https://github.com/forem/forem/blob/c63e0b629e1edd0b7f2ce03952cf6bf552c7b8d8/app/decorators/user_decorator.rb#L23-L34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: merged bot applied label for PR's that are merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Only two My Tags are showing in left nav
3 participants