Giter Site home page Giter Site logo

Comments (6)

rapotek avatar rapotek commented on August 22, 2024

This is strange. Number of rows in cache_visits2 should not exceed number_of_caches * (number_of_users + 2) in worst case, but in real life it should be even a lesser number. Some too old rows are deleted occasionally (randomly).

from opencaching-pl.

andrixnet avatar andrixnet commented on August 22, 2024

from opencaching-pl.

rapotek avatar rapotek commented on August 22, 2024

OK, I looked more closely.

  • In fact there can be more rows than the upper limit defined above because in "usual" case the cache is viewed by a logged in user and the user's id is stored then, but if there is no current user id, that means a cache is viewed by someone who has not logged in, and there is setting in config that coordinates are shown for not logged-in users, the client IP is stored then. Run a select counting "valid" and "invalid" IPs and then you can compare numbers of logged-in visits against anonymous visits.
  • 'C' means total visits for a particular cache while 'U' means last visit made by a particular user (or IP). The 'C' and 'U' are updated when the last visit of a cache for a current user was before given period counting from now.

So there is one thing I didn't notice before that is registering visits for not logged-in (anonymous) users when coordinates are shown.

from opencaching-pl.

andrixnet avatar andrixnet commented on August 22, 2024

from opencaching-pl.

rapotek avatar rapotek commented on August 22, 2024

Regarding your question: in general counter change is invoked by ViewCacheController, so when you read cache data directly from DB or use another approach not involving mentioned controller, the counters shouldn't be changed.

The config settings suggests that opencaching.ro has coordinates visible for non logged-in visitors, so "IP visits" would be counted too. You could change settings to hide coordinates and see the effect, but I think you have them visible for other purposes.
On each attempt of increasing the counter, regardless of last visit period of current cache, there is a 1/1000 chance that "old" rows will be deleted. You could check how many "old" rows there are in database (search by "U" type and visit_date < NOW() - 604800).

Anyway, this functionality could be improved by f.ex. introduce a separate config settings for counting anonymous visits, a config setting for unique visit period (now it is hardcoded) and maybe a cron job to systematically remove "old" rows instead of a randomly invoked action as it is now.

from opencaching-pl.

andrixnet avatar andrixnet commented on August 22, 2024

from opencaching-pl.

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.