Jump to content

Datastore - Update


Graham Quince

Recommended Posts

Hi everyone,

We're adding an improvement to the datastore FDP to prevent duplicate entries.  The Visitor Log, Link Log and Rewards widgets all have duplication checks written into them, so these will not be affected.  If you've used the datastore for your own widgets and have concerns about duplicate entries, feel free to get in touch with me.  I can take a look and if there's a question about it, i can arrange for a developer to help out.

I don't have an ETA for when this change will take place, but it's not in the immediate future.

Graham

Just an update, we're not making changes to the FDP after all.

Link to comment
Share on other sites

Hi Paul,

Currently if you were to pass identical information to the API using datastore/create, it is possible to have two entries in the database.  This has caused problems with some of our internal uses of the datastore, when retrieving information is one record is returned instead of both.  The proposed changes will prevent duplication.

The widgets I've created are all based on the Visitor Log includes a check before creating an entry:

FrogOS.fdp({
                url: 'datastore/get',
                path: '/api/fdp/2/',
                type: 'GET',
                data: {
                    target_uuid: this.options.site_uuid,
                    alias: this.prefs.dataref.value,
                    user_uuid: FrogOS.getUser().uuid
                }
            }).done(function(response) {
                var visit_data,
                    is_update = false;
    
                if (response.response.length) {
                    visit_data = JSON.parse(response.response[0].data);
                    is_update = response.response[0].uuid;
                } else {
                    visit_data = {
                        user_uuid: FrogOS.getUser().uuid,
                        visits: []
                    }
                }
                this.logVisit(visit_data, is_update);

 

Link to comment
Share on other sites

Sorry @Graham Quince I’m still not sure what constitutes a duplicate?

Is it that you will not allow a record with the same user_uuid, target_uuid and alias? If so please don’t do this! Kids tend to get into trouble more than once! We are using one data store record per behaviour incident. Actually we use alias for the subject, but still, kids tend to get into trouble more than once per subject.

At least a year of work is in jeopardy here! This allowed us to finally break free of sims and build our own behaviour system without any constraints.

I can send you some example records for the developers to have a look?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...