Use Stats

Blocks ::: block_use_stats
Maintained by Valery Fremaux
Provides time base use stats indicators. The compilation library is used by the "training session" report plugin.
Latest release:
991 sites
32 fans
Current versions available: 14

IMPORTANT NOTE FOR PLUGIN ARCHIVE AVAILABILITY : due to the large amount of plugins supported, it is NOT affordable for us to update packages. Please use the Source Control urls to our github to get plugins archives

This block samples the user's log records and thresholds the activity backtrace. The main hypothesis is that any activity type unless offline activity or in-classroom activity may underlie a constant loggin track generation.

The block compiles all log events and summarizes all intervals larger than an adjustable threshold. Compilation are also made on a course basis.

The more Moodle is used as a daily content editing tool, the more accurate should be this report.


This plugin is part of set Training session report.


Screenshot #0
Screenshot #1


Valery Fremaux (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Thu, Jun 30, 2016, 5:42 PM
    Hi Feng, the use stat block provides raw results that will be rendered and be easier to extract using the associated trainingsessions report.
  • Fri, Sep 23, 2016, 11:08 PM
    Tout d'abord un grand merci pour vos travaux...j'utilise tous vos suis un fan smile

    Pour la première fois, je rencontre un soucis: je tente d'utiliser votre block Use stats avec une version 3.1+ de moodle + thème Adaptable...mais votre block (2006021700) (que j'avais l'habitude d'utiliser dans les version précédentes) ne veut pas s'afficher. L'installation se passe bien, la rajout de bloc aussi. J'ai accès aux paramètres du plug (d'ailleurs qui s'affiche dans la vue d'ensemble des plugins "2.7.0 (build 2016051700)" et non pas 3.1.0)...mais sur la page d'accueil où je souhaite l'utiliser, le bloc s'affiche mais reste vide en mode édition et disparaît complètement lorsque je quitte le mode édition.

    Auriez-vous une solution pour ce problème et si non, auriez vous une piste pour le résoudre...thème ? Version ?

    Bien cordialement
  • Fri, Sep 23, 2016, 11:18 PM
    Je commence à doute de ma publication 3.1.... je vais remettre le package. Il y des modifications importantes en 3.1 et des abandons d'anciennes fonctions.
  • Tue, Jan 10, 2017, 10:15 PM
    Hi Valery,

    I added your block to a course, and the course site failed to load after that (using the Essential theme). Anyway, I would like to know the SQL query behind the total time spent on course. I've googled for hours and can't find any examples on the SQL how to do this. I would greatly appreciate if you could shed some light on this subject.

  • Rosa
    Thu, Jan 12, 2017, 6:17 PM
    Hi valeria,

    I added your block but if I customize the language it does not leave me because of a problem with your block.
  • Fri, Jan 27, 2017, 6:19 PM
    Hi Valery,
    will there be an update for 3.2
    Thank You
  • Wed, Feb 22, 2017, 6:40 PM
    Hi all, new version of the use_stats plugins has been deeply reviewed to optimize many of the queries and time records processing. This could be done thaks to some of customers that had imperative high duty report output. Compiling time correctly in Moodle considering all possible bias (technical and behavioural) is far from a trivial calculation, but we hope we come now to enough maturity of the process. We ye would like in the future to be more performant on time range queries. At the moment a new caching strategy has been added to save precompilation results for a user/exact timerange pair. I'm sure there are better ways to optimize this. Cheers. Note that the Training Sessions report also has been reviewed and is on publishing process. Note finally that I am changing a bit the publishing strategy. Users are asking more and more accuracy and reliability of the plugins. This needs a huge work on my 130 plugins. The new distribution strategy will offer 2 distributions of the qualit demanding plugins. Community is published here for anyone. Pro version will add performance, additional productvity features, more formats, interoperability, webservices, required by a professional exploitation of the plugins. Cheers
  • Thu, Mar 16, 2017, 1:02 AM
    Debug info: Duplicate entry '76-1488365176' for key 'mdlvn_blocusestatsess_uses_uix'
    INSERT INTO mdlvn_block_use_stats_session (userid,sessionstart,sessionend,courses) VALUES(?,?,?,?)
    [array (
    0 => '76',
    1 => '1488365176',
    2 => 1489017289,
    3 => '11,0',
    Error code: dmlwriteexception
    Stack trace:

    line 482 of /lib/dml/moodle_database.php: dml_write_exception thrown
    line 1259 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
    line 1305 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
    line 641 of /blocks/use_stats/locallib.php: call to mysqli_native_moodle_database->insert_record()
    line 124 of /blocks/use_stats/detail.php: call to use_stats_aggregate_logs()
  • Tue, May 16, 2017, 4:06 PM

    Hi, I would like to know how to access the information of use stats.
  • Tue, Nov 14, 2017, 3:40 PM
    Thanks for your plugin use stats. Its very helpful.
    Unfortunately I faced an issue. We have been using it for many months now and the things were okay. But on the end of October , after i gathered teachers working hours, many complained that the values they noticed are lot higher than the statistics i sent. Same issue was complained by many number of teachers. One has even sent a screen shot. According to few complains, statistics have been reset at the middle or at the end of the month.
    Nothing has been changed from my side and i'm wondering what might have coursed this, as i have checked the hours many times to see no difference.
    I would like to know the location of log files, is it a database table or a file containing data?
    What might have coursed this? Have you came up with similar issues before? How to get around this and how to prevent it from happening in the future?
    I really appreciate your quick response and help regarding this.
    Thanks in advance.
  • Sun, Feb 4, 2018, 6:39 AM
    my moodle version is 3.4.1+
    i downloaded use blocks latest version Release 3.4.0 (build 2017090600)
    but there are installation problem:
    "[Error] Required Moodle version [2018110800]
    Installation aborted due to validation failure"
    what is wrong?
  • Tue, Feb 20, 2018, 2:18 AM
    help please,
    i can not installation Use Block latest release 3.4.0(build 2017090600) on moddle 3.4.1+
    is it not compatible with moodle 3.4.1+ ???
  • Thu, Nov 15, 2018, 12:12 AM
    It seems sources of block_use_stats are now here:
  • Mon, Oct 19, 2020, 12:37 PM
    In the report it shows "Other" appart from the time spent on lessons. What does this Other mean? Your prompt reply is highly appreciated. Thank you.
  • Mon, Jul 26, 2021, 10:25 PM
    where can we access the logs? Which table contains the time logs in our database?
1 2
Please login to post comments