open-craft / xblock-vectordraw

An XBlock for creating vector drawing exercises
GNU Affero General Public License v3.0
2 stars 3 forks source link

Port fix for drawing vectors with id 0 #10

Closed bdero closed 8 years ago

bdero commented 8 years ago

This is a port of the fix to the implicit casting problem as discussed in https://github.com/open-craft/jsinput-vectordraw/pull/24. @itsjeyd

Testing instructions:

  1. Setup a devstack.
  2. Install this xblock on this branch into the edxapp Python virtualenv.

    # In the same directory as your Vagrantfile:
    vagrant ssh -- sudo -u edxapp /edx/bin/pip.edxapp install -e git+https://github.com/open-craft/xblock-vectordraw.git@bdero/port-sven-changes#egg=vectordraw-xblock
  3. Run Studio
  4. Navigate to a course, and then "Settings > Advanced Settings".
  5. Update the "Advanced Module List" field to contain ["vectordraw"].
  6. Click "Save Changes".
  7. Navigate to the outline and create a new Section, Subsection, and Unit. You will be redirected to the Unit authoring view.
  8. Select "Advanced > Vector Drawing" to create a new Vector Drawing problem.
  9. Click "Edit".
  10. Set the "Vectors" field with the following block:

    [
    {
        "name": "1",
        "description": "Vector 1",
        "coords": [
            [
                2.6877256317689535,
                1.3971119133574006
            ],
            [
                2.6877256317689535,
                4.397111913357403
            ]
        ],
        "type": "vector",
        "render": false,
        "length_factor": 1,
        "length_units": "",
        "base_angle": 0,
        "style": {
            "pointSize": 1,
            "pointColor": "red",
            "width": 4,
            "color": "blue",
            "label": null,
            "labelColor": "black"
        },
        "tail": [
            2.6877256317689535,
            1.3971119133574006
        ],
        "tip": [
            2.6877256317689535,
            4.397111913357403
        ],
        "length": 3.000000000000002,
        "angle": 90
    },
    {
        "name": "2",
        "description": "Vector 2",
        "coords": [
            [
                -1,
                1
            ],
            [
                -0.9999999999999998,
                4
            ]
        ],
        "type": "vector",
        "render": false,
        "length_factor": 1,
        "length_units": "",
        "base_angle": 0,
        "style": {
            "pointSize": 1,
            "pointColor": "red",
            "width": 4,
            "color": "blue",
            "label": null,
            "labelColor": "black"
        },
        "tail": [
            -1,
            1
        ],
        "tip": [
            -0.9999999999999998,
            4
        ],
        "length": 3,
        "angle": 90
    }
    ]
  11. Set the "Expected result" field to the following block:

    {
    "1": {
        "tail": [
            2.69,
            1.4
        ],
        "tail_tolerance": 1,
        "tip": [
            2.69,
            4.4
        ],
        "tip_tolerance": 1
    },
    "2": {
        "tail": [
            -1,
            1
        ],
        "tail_tolerance": 1,
        "tip": [
            -0.9999999999999998,
            4
        ],
        "tip_tolerance": 1
    }
    }
  12. Click "Save".
  13. Click and drag on the Vector Drawing problem graph and observe that a vector is drawn.
itsjeyd commented 8 years ago

@bdero :+1: