<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=Development%3AStats_roles_1.7</id>
	<title>Development:Stats roles 1.7 - История изменений</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=Development%3AStats_roles_1.7"/>
	<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:Stats_roles_1.7&amp;action=history"/>
	<updated>2026-05-06T18:45:54Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=Development:Stats_roles_1.7&amp;diff=11902&amp;oldid=prev</id>
		<title>Олег Давидович: 1 версия импортирована</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:Stats_roles_1.7&amp;diff=11902&amp;oldid=prev"/>
		<updated>2024-10-21T08:53:13Z</updated>

		<summary type="html">&lt;p&gt;1 версия импортирована&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Предыдущая версия&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Версия от 08:53, 21 октября 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Олег Давидович</name></author>
	</entry>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=Development:Stats_roles_1.7&amp;diff=11901&amp;oldid=prev</id>
		<title>1&gt;Mjollnir: removed typo from field list in new table structure (userid)</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:Stats_roles_1.7&amp;diff=11901&amp;oldid=prev"/>
		<updated>2006-09-19T10:18:36Z</updated>

		<summary type="html">&lt;p&gt;removed typo from field list in new table structure (userid)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Statistics and reports need to be upgraded to use the new roles in 1.7 rather than user_students and user_teachers.&lt;br /&gt;
&lt;br /&gt;
Penny (penny@catalyst.net.nz) is going to be working on this the week of 18 September. Here&amp;#039;s the plan:&lt;br /&gt;
&lt;br /&gt;
== step 1. new database structure and migration ==&lt;br /&gt;
&lt;br /&gt;
mdl_stats_user_* doesn&amp;#039;t need changing structurally, although roleid needs to migrate to the id of the role to match the legacy role - first out of the returned array by:&lt;br /&gt;
* get_roles_with_capability(&amp;#039;moodle/legacy:teacher&amp;#039;, CAP_ALLOW) and &lt;br /&gt;
* get_roles_with_capability(&amp;#039;moodle/legacy:student&amp;#039;, CAP_ALLOW)&lt;br /&gt;
 &lt;br /&gt;
mdl_stats_* needs changing to:&lt;br /&gt;
* id&lt;br /&gt;
* courseid&lt;br /&gt;
* roleid&lt;br /&gt;
* timeend&lt;br /&gt;
* stattype&lt;br /&gt;
* stat1 &lt;br /&gt;
* stat2&lt;br /&gt;
&lt;br /&gt;
the existing structure will migrate to:&lt;br /&gt;
&lt;br /&gt;
* students/teachers/activestudents/activeteachers:&lt;br /&gt;
&lt;br /&gt;
two rows: (stattype = &amp;#039;enrolments&amp;#039;)&lt;br /&gt;
# roleid - student (legacy), student = statreads, activestudents = statwrites&lt;br /&gt;
# roleid - teacher (legacy), teacher = statreads, activeteachers = statwrites&lt;br /&gt;
&lt;br /&gt;
* studentreads/studentwrites/teacherreads/teacherwrites&lt;br /&gt;
&lt;br /&gt;
two rows: (stattype = &amp;#039;activity&amp;#039;) &lt;br /&gt;
# roleid - student (legacy), studentreads = statreads, studentwrites = statwrites&lt;br /&gt;
# roleid - teacher (legacy), teacherreads = statreads, teacherwrites = statwrites&lt;br /&gt;
&lt;br /&gt;
* logins/uniquelogins&lt;br /&gt;
&lt;br /&gt;
one row: (stattype = &amp;#039;logins&amp;#039;)&lt;br /&gt;
# roleid - 0 (n/a) logins = statreads, uniquelogins = statwrites&lt;br /&gt;
&lt;br /&gt;
== step 2. new processing at cron ==&lt;br /&gt;
&lt;br /&gt;
add in an extra loop in the stats_cron_* functions: loop through roles used in context (course in this case) get_roles_used_in_context, rather than join mdl_log on mdl_user_students and/or mdl_user_teachers, do something more like:&lt;br /&gt;
&lt;br /&gt;
      SELECT COUNT(l.id) &lt;br /&gt;
            FROM mdl_log l &lt;br /&gt;
            JOIN mdl_role_assignments ra ON l.userid = ra.userid &lt;br /&gt;
            JOIN mdl_context c ON ra.contextid = c.id &lt;br /&gt;
            WHERE l.course = $course AND c.instanceid = $course &lt;br /&gt;
            AND c.aggregatelevel = CONTEXT_COURSE &lt;br /&gt;
            AND ra.roleid = $roleid&lt;br /&gt;
            AND $logfilterstuff&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
the calls to stats_do_&amp;lt;timeperiod&amp;gt;_user_cron just need to be changed to use the roles that we got from get_roles_used_in_context rather than 1 for student and 2 for teacher.&lt;br /&gt;
&lt;br /&gt;
== step 3. reports ==&lt;br /&gt;
&lt;br /&gt;
some of these will need to change as we are currently just expecting ONE row returned, where now we will have many rows (one per role) for the same stattype.&lt;br /&gt;
&lt;br /&gt;
# STATS_MODE_GENERAL&lt;br /&gt;
## STATS_REPORT_ACTIVITY - all reads vs all writes - add up for all roles (currently studentreads+studentwrites vs teacherreads+teacherwrites)&lt;br /&gt;
## STATS_REPORT_STUDENTACTIVITY - \&lt;br /&gt;
## STATS_REPORT_TEACHERACTIVITY - / these two get dropped and replaced by STATS_REPORT_BYROLE ($roleid)&lt;br /&gt;
## STATS_REPORT_READS - graph all roles as lines instead of student vs teacher&lt;br /&gt;
## STATS_REPORT_WRITES - graph all roles as lines instead of student vs teachers&lt;br /&gt;
## STATS_REPORT_LOGINS - doesn&amp;#039;t need to change, roleid is already 0&lt;br /&gt;
&lt;br /&gt;
#STATS_MODE_DETAILED - these don&amp;#039;t need to change sql, but the ui will need to change. perhaps the best way to go is: select course /select role / select user, select time period, GO!&lt;br /&gt;
## STATS_REPORT_USER_ACTIVITY &lt;br /&gt;
## STATS_REPORT_USER_ALLACTIVITY &lt;br /&gt;
## STATS_REPORT_USER_LOGINS&lt;br /&gt;
## STATS_REPORT_USER_VIEW - this one is fine, it&amp;#039;s not dynamic (user profile stats)&lt;br /&gt;
&lt;br /&gt;
# STATS_MODE_RANKED - these all need to change to add up for all roles and deal with group/aggregate rather than just getting a list of fields to return.&lt;br /&gt;
## STATS_REPORT_ACTIVE_COURSES&lt;br /&gt;
## STATS_REPORT_ACTIVE_COURSES_WEIGHTED&lt;br /&gt;
## STATS_REPORT_PARTICIPATORY_COURSES&lt;br /&gt;
## STATS_REPORT_PARTICIPATORY_COURSES_RW&lt;/div&gt;</summary>
		<author><name>1&gt;Mjollnir</name></author>
	</entry>
</feed>