Commit graph

25 commits

Author SHA1 Message Date
PJ
67bb7a6e76
Revert "Bump sidekiq and sidekiq-unique-jobs dependencies in tandem" (#20132) 2023-09-18 13:27:08 -04:00
PJ
2a1c20b57f
Bump sidekiq and sidekiq-unique-jobs dependencies in tandem (#20131)
* bump sidekiq and sidekiq-unique-jobs in tandem

* ensure Articles::UpdatePageViewsWorker arg is a hash
2023-09-18 12:22:35 -04:00
Jeremy Friesen
5ec47d99dc
Ensuring we don't track views of author or unpublished (#16143)
* Ensuring we don't track views of author or unpublished

Prior to this commit, I was surprised to learn that we:

1) Tracked an author's view of their article.
2) Tracked views of an unpublished article.

This came up from a Forem creator asking if they could reset the view
counter.  Or trigger the reset on publication.

I think a general business logic policy of don't track views for the
author and don't track views for unpublished articles is a reasonable
default.

Were we to pursue the clear views on publication, we'd need to consider
something that went from unpublished -> published -> unpublished ->
published.  Without a more explicit state machine, triggering a
busineiss logic behavior seems a bit unexpected.

In other words, I wrote an article.  There are 20 views when I realize
that I need to unpublished it.  I make the changes in the unpublished
state, and re-publish.  I'd assume that those 20 views would still be
"recorded" and counted towards my article's view counts.

* Adjusting condition structure

Prior to this commit, the `if` clause was rather far to the right.  This
helps make the if clause more pronounced.
2022-01-18 11:23:18 -05:00
Jeremy Friesen
b6c58d329f
Adding documentation and constant (#16140)
* Adding documentation and constant

This loosely relates to a request for information from Success team
about whether or not viewing a draft article counts towards it's stats.

* Apply suggestions from code review

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-01-17 17:21:28 -05:00
Michael Kohl
2555b59d87
Extract page view updates into workers (#12686)
* Extract page view updates into workers

* Restructure code

* Update specs

* Fix and reactive 2 specs

* Update according to PR feedback

* Use create! over create
2021-02-17 09:24:05 +07:00
Krzysztof Rybka
397a1c2389
Update page views counters a little bit more often (#11286) 2020-11-06 13:09:11 -05:00
Molly Struve
ca3452f044
Refactor:Remove Production Conditional for Page View Updates (#11164) 2020-10-30 13:32:54 -05:00
Michael Kohl
a4dadfb728
Standardize ActiveRecord order clauses (#9395)
* Change simple order clauses

* Change nested order clauses
2020-07-20 10:00:51 -04:00
rhymes
f1ec04a0c9
Rubocop: move dot in multi-line calls to leading position (#9262) 2020-07-16 15:51:11 +02:00
rhymes
5b62811c98
[deploy] Rubocop: fix violations of Layout/LineLength (#9197) 2020-07-08 08:36:36 -05:00
Ben Halpern
e260f86e69
[deploy] Add trailing slash back in (#8838) 2020-06-22 17:22:42 -04:00
Vaidehi Joshi
c4d9c4aed9
Remove trailing slashes from URLs to improve SEO (#8836) [deploy] 2020-06-22 13:44:58 -07:00
Molly Struve
faa4325c1f
Only Update page_views When They Are Valid (ie created) (#5195) [deploy] 2019-12-26 11:28:18 -06:00
Molly Struve
f26a6f49d2 Revert "Use raw SQL to Update page_views so new and existing Records can be updated (#5167) [deploy]" (#5185)
This reverts commit 9a7fb3b04e.
2019-12-19 16:43:37 -05:00
Molly Struve
9a7fb3b04e
Use raw SQL to Update page_views so new and existing Records can be updated (#5167) [deploy] 2019-12-19 14:28:32 -06:00
Molly Struve
2d6d611634 switch back to update_column to improve performance (#5074) [deploy] 2019-12-10 18:38:04 -05:00
Molly Struve
3f8a6caa72
Use find_or_create_by when updating a pageview and use update in case of creation (#5066) [deploy] 2019-12-10 13:48:50 -06:00
Ben Halpern
eaf6ea2f4b
Update pageviews count less often in page_views_controller (#4945) [deploy] 2019-11-26 14:11:47 -05:00
Ben Halpern
befefd08d0
Remove extra dependencies for PageViewsController (#4923) [deploy]
* Remove extra dependencies for PageViewsController

* Fix strongparams and fix typo

* Fix spec

* Remove unnecessary page_view param

* Remove additional unnecessary page_view

* Create ApplicationMetalController for shared Metal behavior

* Revert rand numbers to ensure apples-to-apples perf compare

* Whoops, revert change revert

* Clarify comment
2019-11-25 19:06:34 -05:00
Ben Halpern
36479f09c3
Replace current_user.id with session_current_user_id (#4880) [deploy]
* Replace current_user.id with efficient_current_user_id in high-leverage areas

* Update name of efficient_current_user_id

* Replace user_signed_in? in pageviews

* Remove unneeded ?
2019-11-22 14:27:43 -05:00
rhymes
7da7a16d8d Pro: add referrers to dashboard and single article stats (#3295)
* Reorganize PageViewsController

* Add domain and path to PageView model

* Add before_create callback to populate domain and path

* Add list of referrers to AnalyticsService

* Add referrers to the UI

* Remove useless referrers card and tweak table line height

* Add referrer stats to article stats page

* Add not null and empty default to domain and path

* Refactor JS analytics client

* create_list is a step back here

* Revert "Add not null and empty default to domain and path"

This reverts commit bc02440076047a887c65d300bccd4661ecc8ffd0.

* Add index on domain concurrently

* Make the script more robust
2019-06-25 13:58:09 -04:00
Ben Halpern
4b1b137c0f
Fix/augment dashboard and article view count issues (#2449) 2019-04-15 10:24:38 -04:00
Ben Halpern
7bf37108b1
Night theme improvements + small fixes (#2114) 2019-03-19 13:36:30 -04:00
Ben Halpern
c901c7138d
Fix possible race condition with page view tracking (#2103)
* Fix possible race condition with page view tracking

* Change min number to check for html variant calculation
2019-03-18 15:53:13 -04:00
Ben Halpern
825aa9be91
Add page_view model (#1985)
* Add page_view model

* Uncomment DJ routes

* Add time on site max and don't update article page views every time
2019-03-07 11:53:33 -08:00