Giter Club home page Giter Club logo

Comments (6)

otacke avatar otacke commented on June 9, 2024

@phgrosjean I am a little confused, whether this is some suggestion for H5PxAPIkatchu or for H5P.

H5PxAPIkatchu stores the time of each that the statement was received https://github.com/otacke/h5pxapikatchu/blob/master/class-database.php#L464.

If you want a timestamp to be included in every xAPI statement emitted by H5P, you should address the H5P core team. It's possible to implement, but it is an optional property in the xAPI specification, and Learning Record Stores (or whatever stores the events) should set it if not provided (https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Data.md#details-1) like H5PxAPIkatchu or the H5P plugins do for reporting.

from h5pxapikatchu.

otacke avatar otacke commented on June 9, 2024

@phgrosjean Ah, I think now I get it. You were referencing the xAPI data that you can retrieve from the filter, and those don't contain the timestamp. Shouldn't be an issue for you to set it yourself. I might do that in the future if I find some time.

from h5pxapikatchu.

phgrosjean avatar phgrosjean commented on June 9, 2024

@otacke Yes, that's it. But as soon as it is recorded in the database, it is fine. I can recover it and I don't need more. But it would be fine to retrieve the timestamp from the filter too.

from h5pxapikatchu.

otacke avatar otacke commented on June 9, 2024

Hi @phgrosjean !

I have given this some thought, and I think I won't add this to H5PxAPIkatchu. It might be convenient, but it feels weird to have an extra function just for getting the time or to modify the original statement that I want to preserve. As I mentioned, it's up to the LRS (or whatever stores the data) anyway to set the timestamp if it's not included in the xAPI statement. So if you require it, I suggest you set it yourself. You can use the h5pxapikatchu_insert_data_xapi filter and add the time like:

function handle_xapi_data( $xapi ) {
  // Change from JavaScript
  $xapi = str_replace( '\"', '"', $xapi );
  $xapi = str_replace( "\'", "'", $xapi );
  $xapi = str_replace( '\\\\"', '"', $xapi );

  $xapi_decoded = json_decode( $xapi, true );

  // xAPI Timestamp following RFC 3339
  $xapi_decoded['timestamp'] = current_time( 'Y-m-d\TH:i:s.vP' );

  /*
   * Process $xapi_decoded as required here
   * ...
   */

  return $xapi;
}
add_filter( 'h5pxapikatchu_insert_data_xapi', 'handle_xapi_data' );```

from h5pxapikatchu.

phgrosjean avatar phgrosjean commented on June 9, 2024

Hello @otacke OK, I understand. I already did this, but I was considering it as a basic feature useful for everyone because xAPI events without time indication represent really only partial information. So now, I close the issue.

from h5pxapikatchu.

otacke avatar otacke commented on June 9, 2024

@phgrosjean Feel free to add a feature request addressing the H5P core team. They could add the timestamp to every single xAPI statement.

from h5pxapikatchu.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.