Quiz report: Started on in a date format, duration in a time format and with IP addresses

Quiz report: Started on in a date format, duration in a time format and with IP addresses

by Visvanath Ratnaweera -
Number of replies: 4
Picture of Particularly helpful Moodlers Picture of Translators
Hi all

Has anybody generated the quiz report with the following modifications:
- the "started on" column in a standard date format
- duration in a time format, or numerical in seconds
- the IP address of the candidate (as seen by the server)

Could be a SQL output or a spread-sheet.

The Moodle version is 2.7.
Average of ratings: -
In reply to Visvanath Ratnaweera

Re: Quiz report: Started on in a date format, duration in a time format and with IP addresses

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
In case my previous enquiry was unclear, here is another try.

When request the marks of a test as an Excel spread sheet, the duration is in text, eg. 10 min 34 sec. I would like to have it as a number, say 634 (sec). The starting time is similar.

And I need a new column with the IP address.

Any idea how I get such a report?
In reply to Visvanath Ratnaweera

Re: Quiz report: Started on in a date format, duration in a time format and with IP addresses

by Daniel Thies -
Picture of Core developers Picture of Plugin developers Picture of Testers

The easiest method might be to use a language customization to change strftimedatetime which uses unix date format string arguments.

In reply to Daniel Thies

Re: Quiz report: Started on in a date format, duration in a time format and with IP addresses

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi Daniel

Thanks for the "trick"! Haven't tested, but believe doable.

So the other information, the IP-address, seems to be more difficult. Does it have to be an own SQL querry?
In reply to Visvanath Ratnaweera

Re: Quiz report: Started on in a date format, duration in a time format and with IP addresses

by Daniel Thies -
Picture of Core developers Picture of Plugin developers Picture of Testers

Yes, and you will have to think about how you want to determine IP address. There is not normally a unique IP for a quiz attempt unless you restrict this somehow. The IP is logged and you would probably have to match the attempt context with an event in the log table. If you know it is unique, you could use either start or submission events. If it is not unique, you would find a list of IPs used.

You could do the whole thing using the custom SQL Block if you prefer that to working with PHP. However, it is not difficult in the quiz report API to add an additional column. It just requires adding a couple simple methods to do the IP lookup and return the information.

Average of ratings: Useful (1)