レポート統計が表示されない

レポート統計が表示されない

- dorataro don の投稿
返信数: 7

現在,学内で小規模なMoodleを運用しています(100人程度).

CentOS 7.2

Moodle 3.1 (Build: 20160523)

Apache 2.1.6

MySQL 5.7

PHP 5.4.16

を使用しています.

サイト管理>レポート>統計

で,「申し訳ございません、表示するデータがありません。」と表示されます.

cron.phpは,crontabで5分おきに動作していることをログで確認しています.

Moodleの設定で,統計は有効になっています.

統計を表示させたいのですが,方法が分かりません.お願いします.


以下,cron.phpの実行結果です.

Server Time: Fri, 11 Nov 2016 14:56:21 +0900


Execute scheduled task: 古いセッションを削除する (core\task\session_cleanup_task)
... started 14:56:21. Current memory use 19MB.
... used 7 dbqueries
... used 0.015741109848022 seconds
Scheduled task complete: 古いセッションを削除する (core\task\session_cleanup_task)
Execute scheduled task: 新しいユーザパスワードを送信する (core\task\send_new_user_passwords_task)
... started 14:56:21. Current memory use 20.5MB.
... used 1 dbqueries
... used 0.00070905685424805 seconds
Scheduled task complete: 新しいユーザパスワードを送信する (core\task\send_new_user_passwords_task)
Execute scheduled task: ログイン失敗通知を送信する (core\task\send_failed_login_notifications_task)
... started 14:56:21. Current memory use 20.5MB.
... used 2 dbqueries
... used 0.0010991096496582 seconds
Scheduled task complete: ログイン失敗通知を送信する (core\task\send_failed_login_notifications_task)
Execute scheduled task: プラグインのレガシーcron処理 (core\task\legacy_plugin_cron_task)
... started 14:56:21. Current memory use 20.6MB.
Running auth crons if required...
Running enrol crons if required...
Starting activity modules
Processing module function assign_cron ...
... used 4 dbqueries
... used 0.15465497970581 seconds
done.
Processing module function quiz_cron ...

  Looking for quiz overdue quiz attempts...
  Considered 0 attempts in 0 quizzes.
Starting quiz reports
Finished quiz reports
... used 2 dbqueries
... used 0.096688985824585 seconds
done.
Processing module function workshop_cron ...
 processing workshop subplugins ...
Starting workshop allocation methods
Processing cron function for workshopallocation_scheduled...
... started 14:56:22. Current memory use 37.2MB.
... no workshops awaiting scheduled allocation. done. (1 dbqueries, 0 seconds)
Finished workshop allocation methods
... used 6 dbqueries
... used 0.0725998878479 seconds
done.
Finished activity modules
Starting blocks
Processing cron function for recent_activity....done.
Finished blocks
Starting admin reports
Finished admin reports
Starting course reports
Finished course reports
Starting gradebook plugins
Finished gradebook plugins
Starting repository plugins
Processing cron function for repository_dropbox...
... started 14:56:22. Current memory use 40.4MB.
done. (1 dbqueries, 0 seconds)
Processing cron function for repository_filesystem...
... started 14:56:22. Current memory use 40.4MB.
done. (3 dbqueries, 0 seconds)
Finished repository plugins
... used 25 dbqueries
... used 0.46435713768005 seconds
Scheduled task complete: プラグインのレガシーcron処理 (core\task\legacy_plugin_cron_task)
Execute scheduled task: 評定表のバックグラウンド処理 (core\task\grade_cron_task)
... started 14:56:22. Current memory use 40.4MB.
... used 2 dbqueries
... used 0.0009620189666748 seconds
Scheduled task complete: 評定表のバックグラウンド処理 (core\task\grade_cron_task)
Execute scheduled task: イベントのバックグラウンド処理 (core\task\events_cron_task)
... started 14:56:22. Current memory use 40.4MB.
... used 2 dbqueries
... used 0.00054311752319336 seconds
Scheduled task complete: イベントのバックグラウンド処理 (core\task\events_cron_task)
Execute scheduled task: 標準完了データを計算する (core\task\completion_regular_task)
... started 14:56:22. Current memory use 40.5MB.
... used 6 dbqueries
... used 0.0056109428405762 seconds
Scheduled task complete: 標準完了データを計算する (core\task\completion_regular_task)
Execute scheduled task: ポートフォリオプラグインのバックグラウンド処理 (core\task\portfolio_cron_task)
... started 14:56:22. Current memory use 40.9MB.
... used 0 dbqueries
... used 8.2969665527344E-5 seconds
Scheduled task complete: ポートフォリオプラグインのバックグラウンド処理 (core\task\portfolio_cron_task)
Execute scheduled task: 盗作プラグインのレガシーcroonによるバックグラウンド処理 (core\task\plagiarism_cron_task)
... started 14:56:22. Current memory use 40.9MB.
... used 0 dbqueries
... used 0.00058484077453613 seconds
Scheduled task complete: 盗作プラグインのレガシーcroonによるバックグラウンド処理 (core\task\plagiarism_cron_task)
Execute scheduled task: カレンダー通知を送信する (core\task\calendar_cron_task)
... started 14:56:22. Current memory use 41MB.
Updating calendar subscriptions:
... started 14:56:22. Current memory use 41.8MB.
Finished updating calendar subscriptions.
... used 1 dbqueries
... used 0.0082099437713623 seconds
Scheduled task complete: カレンダー通知を送信する (core\task\calendar_cron_task)
Execute scheduled task: 外部ブログを同期する (core\task\blog_cron_task)
... started 14:56:22. Current memory use 41.9MB.
... used 2 dbqueries
... used 0.0053439140319824 seconds
Scheduled task complete: 外部ブログを同期する (core\task\blog_cron_task)
Execute scheduled task: 問題エンジンのバックグラウンド処理 (core\task\question_cron_task)
... started 14:56:22. Current memory use 42.2MB.

  Cleaning up old question previews...done.

  Cleaning up old question statistics cache records...done.
... used 6 dbqueries
... used 0.006878137588501 seconds
Scheduled task complete: 問題エンジンのバックグラウンド処理 (core\task\question_cron_task)
Execute scheduled task: フォーラムメーリングおよびメンテナンスジョブ (mod_forum\task\cron_task)
... started 14:56:22. Current memory use 43.5MB.
Starting digest processing...
Cleaned old digest records
... used 5 dbqueries
... used 0.036710023880005 seconds
Scheduled task complete: フォーラムメーリングおよびメンテナンスジョブ (mod_forum\task\cron_task)
Execute scheduled task: 受信メールピックアップ (tool_messageinbound\task\pickup_task)
... started 14:56:22. Current memory use 44.4MB.
Inbound Message not fully configured - exiting early.
... used 0 dbqueries
... used 0.0015170574188232 seconds
Scheduled task complete: 受信メールピックアップ (tool_messageinbound\task\pickup_task)
Execute scheduled task: 不要なイベントモニタイベントをすべて削除する (tool_monitor\task\clean_events)
... started 14:56:22. Current memory use 44.6MB.
... used 0 dbqueries
... used 0.0002288818359375 seconds
Scheduled task complete: 不要なイベントモニタイベントをすべて削除する (tool_monitor\task\clean_events)
Cron script completed correctly
Cron completed at 14:56:22. Memory used 44.6MB.
Execution took 1.163778 seconds

dorataro don への返信

Re: レポート統計が表示されない

- Mitsuhiro Yoshida の投稿
画像 Developers 画像 Particularly helpful Moodlers 画像 Translators

「管理 > サイト管理 > 拡張機能」ページで「統計を有効にする enablestats」を有効にしてから1週間 (60*60*24*7) 経過していないのが「 レポート統計が表示されない」原因だと思われます。そのため、統計が表示されるまで最大1週間程お待ちください。

具体的には下記部分で統計データの利用可否を判断しています。
------------------------------------------------------

該当プログラムファイル:
report/stats/locallib.php

該当箇所:
102行目

該当コード:
    $reportoptions = stats_get_report_options($course->id, $mode);
    $timeoptions = report_stats_timeoptions($mode);
    if (empty($timeoptions)) {
        print_error('nostatstodisplay', '', $CFG->wwwroot.'/course/view.php?id='.$course->id);
    }

備考:
エラーメッセージ「申し訳ございません、表示するデータがありません」を表示しています。

------------------------------------------------------

該当プログラムファイル:
report/stats/locallib.php

該当箇所:
54行目

該当コード:
function report_stats_timeoptions($mode) {
    global $CFG, $DB;

    if ($mode == STATS_MODE_DETAILED) {
        $earliestday = $DB->get_field_sql('SELECT MIN(timeend) FROM {stats_user_daily}');
        $earliestweek = $DB->get_field_sql('SELECT MIN(timeend) FROM {stats_user_weekly}');
        $earliestmonth = $DB->get_field_sql('SELECT MIN(timeend) FROM {stats_user_monthly}');
    } else {
        $earliestday = $DB->get_field_sql('SELECT MIN(timeend) FROM {stats_daily}');
        $earliestweek = $DB->get_field_sql('SELECT MIN(timeend) FROM {stats_weekly}');
        $earliestmonth = $DB->get_field_sql('SELECT MIN(timeend) FROM {stats_monthly}');
    }


    if (empty($earliestday)) $earliestday = time();
    if (empty($earliestweek)) $earliestweek = time();
    if (empty($earliestmonth)) $earliestmonth = time();

    $now = stats_get_base_daily();
    $lastweekend = stats_get_base_weekly();
    $lastmonthend = stats_get_base_monthly();

    return stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth);
}
備考:
統計用データベーステーブルより統計データの直近のUNIX時間 (日・週・月) を取得しています。

------------------------------------------------------

該当プログラムファイル:
lib/statslib.php

該当箇所:
1325行目

該当コード:
function stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth) {

    $now = stats_get_base_daily(time());
    // it's really important that it's TIMEEND in the table. ie, tuesday 00:00:00 is monday night.
    // so we need to take a day off here (essentially add a day to $now
    $now += 60*60*24;

    $timeoptions = array();

    if ($now - (60*60*24*7) >= $earliestday) {
        $timeoptions[STATS_TIME_LASTWEEK] = get_string('numweeks','moodle',1);
    }
    if ($now - (60*60*24*14) >= $earliestday) {
        $timeoptions[STATS_TIME_LAST2WEEKS] = get_string('numweeks','moodle',2);
    }
    if ($now - (60*60*24*21) >= $earliestday) {
        $timeoptions[STATS_TIME_LAST3WEEKS] = get_string('numweeks','moodle',3);
    }
    if ($now - (60*60*24*28) >= $earliestday) {
        $timeoptions[STATS_TIME_LAST4WEEKS] = get_string('numweeks','moodle',4);// show dailies up to (including) here.
    }
    if ($lastweekend - (60*60*24*56) >= $earliestweek) {
        $timeoptions[STATS_TIME_LAST2MONTHS] = get_string('nummonths','moodle',2);
    }
    if ($lastweekend - (60*60*24*84) >= $earliestweek) {
        $timeoptions[STATS_TIME_LAST3MONTHS] = get_string('nummonths','moodle',3);
    }
    if ($lastweekend - (60*60*24*112) >= $earliestweek) {
        $timeoptions[STATS_TIME_LAST4MONTHS] = get_string('nummonths','moodle',4);
    }
    if ($lastweekend - (60*60*24*140) >= $earliestweek) {
        $timeoptions[STATS_TIME_LAST5MONTHS] = get_string('nummonths','moodle',5);
    }
    if ($lastweekend - (60*60*24*168) >= $earliestweek) {
        $timeoptions[STATS_TIME_LAST6MONTHS] = get_string('nummonths','moodle',6); // show weeklies up to (including) here
    }
    if (strtotime('-7 months',$lastmonthend) >= $earliestmonth) {
        $timeoptions[STATS_TIME_LAST7MONTHS] = get_string('nummonths','moodle',7);
    }
    if (strtotime('-8 months',$lastmonthend) >= $earliestmonth) {
        $timeoptions[STATS_TIME_LAST8MONTHS] = get_string('nummonths','moodle',8);
    }
    if (strtotime('-9 months',$lastmonthend) >= $earliestmonth) {
        $timeoptions[STATS_TIME_LAST9MONTHS] = get_string('nummonths','moodle',9);
    }
    if (strtotime('-10 months',$lastmonthend) >= $earliestmonth) {
        $timeoptions[STATS_TIME_LAST10MONTHS] = get_string('nummonths','moodle',10);
    }
    if (strtotime('-11 months',$lastmonthend) >= $earliestmonth) {
        $timeoptions[STATS_TIME_LAST11MONTHS] = get_string('nummonths','moodle',11);
    }
    if (strtotime('-1 year',$lastmonthend) >= $earliestmonth) {
        $timeoptions[STATS_TIME_LASTYEAR] = get_string('lastyear');
    }

    $years = (int)date('y', $now) - (int)date('y', $earliestmonth);
    if ($years > 1) {
        for($i = 2; $i <= $years; $i++) {
            $timeoptions[$i*12+20] = get_string('numyears', 'moodle', $i);
        }
    }

    return $timeoptions;
}

備考:
渡されたUNIX時間をもとに下記lib/statslib.phpの47行目で定義されている利用可能な統計の範囲を返します。

// start after 0 = show dailies.
define('STATS_TIME_LASTWEEK',1);
define('STATS_TIME_LAST2WEEKS',2);
define('STATS_TIME_LAST3WEEKS',3);
define('STATS_TIME_LAST4WEEKS',4);

// start after 10 = show weeklies
define('STATS_TIME_LAST2MONTHS',12);

define('STATS_TIME_LAST3MONTHS',13);
define('STATS_TIME_LAST4MONTHS',14);
define('STATS_TIME_LAST5MONTHS',15);
define('STATS_TIME_LAST6MONTHS',16);

// start after 20 = show monthlies
define('STATS_TIME_LAST7MONTHS',27);
define('STATS_TIME_LAST8MONTHS',28);
define('STATS_TIME_LAST9MONTHS',29);
define('STATS_TIME_LAST10MONTHS',30);
define('STATS_TIME_LAST11MONTHS',31);
define('STATS_TIME_LASTYEAR',32);

------------------------------------------------------

Mitsuhiro Yoshida への返信

Re: レポート統計が表示されない

- dorataro don の投稿

設定ファイルの場所,内容まで教えていただきありがとうございます.

1週間待ってみて,それでも改善されないようであればもう一度設定を確認してみます.

Mitsuhiro Yoshida への返信

Re: レポート統計が表示されない

- dorataro don の投稿

正常に統計がとれることが確認できました.

しかし,「期間」の選択が1週間毎しかありません.1時間毎の統計を表示させることは可能ですか?

dorataro don への返信

Re: レポート統計が表示されない

- Mitsuhiro Yoshida の投稿
画像 Developers 画像 Particularly helpful Moodlers 画像 Translators

> 1時間毎の統計を表示させることは可能ですか?

いいえ、現在のところ、1時間毎の統計を表示させることはできません。

Mitsuhiro Yoshida への返信

Re: レポート統計が表示されない

- dorataro don の投稿
返信遅くなって申し訳ありません.
色々とPlugin等も探してみましたが,見当たりませんでした.
時間毎の統計を出力するDailyというPluginを見つけましたが,どうやらMoodle3.0系に対応してないのか,何も表示されませんでした.
他に思い当たる方法はありますか?
dorataro don への返信

Re: レポート統計が表示されない

- Mitsuhiro Yoshida の投稿
画像 Developers 画像 Particularly helpful Moodlers 画像 Translators

AWStatsのようなアクセス解析ツールを試されてはいかがでしょうか。

[AWStats - Free log file analyzer for advanced statistics (GNU GPL)]
http://www.awstats.org/

Mitsuhiro Yoshida への返信

Re: レポート統計が表示されない

- dorataro don の投稿

Apacheのアクセスログごと解析する方法ですね、なるほど。

週明けにさっそく試してみたいと思います。

ありがとうございます。