GithubHelp home page GithubHelp logo

Comments (8)

r03ert0 avatar r03ert0 commented on July 21, 2024 1

This is another example
test.json.zip

from microdraw.

xgui3783 avatar xgui3783 commented on July 21, 2024

hmm makes sense.

so on annotation load, client calculates hash. on subsequent saves, client calculates hashes. If the hash is different, it sends to the server to be saved.

I think it should be implemented in microdraw.js and not in save.js.
Perhaps with a new method, something like getUnsavedAnnotations() which returns (or resolves) all annotations with hashes different to the previous save.

This could also solve a widely requested feature in our institute: showing which annotation are modified, and show warning if user is about to navigate away.

from microdraw.

r03ert0 avatar r03ert0 commented on July 21, 2024

the getUnsavedAnnotations idea is good!
I merged a PR for the programmatic upload. I haven't removed the hash stuff yet.

from microdraw.

r03ert0 avatar r03ert0 commented on July 21, 2024

(i'll close the issue, because of PR #187 , but we can keep the discussion here)

from microdraw.

xgui3783 avatar xgui3783 commented on July 21, 2024

commit looks great.

Curious as if req.body.action is still needed? we could simplify the code a lot.

from microdraw.

r03ert0 avatar r03ert0 commented on July 21, 2024

it's true. It's kind of redundant with upload

from microdraw.

r03ert0 avatar r03ert0 commented on July 21, 2024

@xgui3783 ? How and where would you add tests for the functions inside /api/index.js?
I have, for example, this one:

    it('should detect a proper annotation object as such', (done) => {
        const ann = [{annotation:{path:[
            "Path",
            {applyMatrix:true,segments:[[10,10],[20,20]],closed:true,fillColor:[1,0,0,1],strokeColor:[0,0,0],strokeScaling:false}
        ],"name": "Test"}}];
        assert(validateAnnotation(ann)).to.be.true;
        done();
    });

from microdraw.

xgui3783 avatar xgui3783 commented on July 21, 2024

testing saveFromAPI ?

Hmm my approach would be changing

const saveFromAPI = function () {}

to

const saveFromAPI = function () {}
exports.saveFromAPI = saveFromAPI

then one can import the function like this:

const { saveFromAPI } = require('./api/index.js')

from microdraw.

Related Issues (20)

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.