Uploaded image for project: 'Community Development'
  1. Community Development
  2. COMDEV-146

countaccounts.py can miss a days worth of new accounts

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Projects Tool
    • None

    Description

      The script countaccounts.py is currently run once a day at midnight (or just after).

      It currently only counts entries for the current month, so will not count entries that were added after it has already run on the last day of the month. (However, entries for the 1st day of the month that occur later in the day will be picked up by a subsequent run.)

      [It also fetches the time twice, which could result in odd behaviour]

      It's not possible to ensure that it runs just before the day changes (e.g. if cron tries to start it at 23:59 it may actually start after midnight).

      It looks as though it may be necessary to have the first run occur just after midnight in order to create the initial empty entry.

      One way round the problem would be to check for day one of a month.
      If so, then subtract a full day and check additionally for the previous month.

      Another approach would be to always add up the counts for each month.
      However, this would also record subsequent deletions. Also care would need to be taken to ensure that historic entries were not deleted. Perhaps check if there is an existing entry, and only update it if the new count is higher?

      Note that the current data is inaccurate because of the timing issue.

      Attachments

        Activity

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: