knittingpattern icon indicating copy to clipboard operation
knittingpattern copied to clipboard

Add instrucion default to row

Open niccokunzmann opened this issue 8 years ago • 7 comments

currently, only the color is inherited from the row. This breaks with the generality of the format.

Instead of

      "id" : "A.2.1",
      "color" : "mocha latte",
      "instructions" : [
        {},
        {
          "type" : "yo"
        },

It should be

      "id" : "A.2.1",
      "instruction default" : {
        "color" : "mocha latte",
      },
      "instructions" : [
        {},
        {
          "type" : "yo"
        },

where "instruction default" is the prototype for all instructions in that row.

niccokunzmann avatar Aug 09 '16 17:08 niccokunzmann

Can I try to work on this issue...?

jainaman224 avatar Feb 25 '17 17:02 jainaman224

Sure! If you have questions or need some help, you can ask.

niccokunzmann avatar Feb 25 '17 18:02 niccokunzmann

Can you please tell me how to test changes and which files except image_to_knittingpattern.py inside convert directory are needed to be updated...? It will be great help for me to get started.

jainaman224 avatar Feb 25 '17 20:02 jainaman224

I believe, there is only one test for this:

https://github.com/fossasia/knittingpattern/blob/master/knittingpattern/test/test_row_instructions.py#L264

It can be totally modified.

niccokunzmann avatar Feb 26 '17 11:02 niccokunzmann

272 is the line with the row specification.

niccokunzmann avatar Feb 26 '17 11:02 niccokunzmann

{
  "version" : "0.1",
  "type" : "knitting pattern", 
  "comment" : {
    "markdown" : "This pattern is taken from [garnstudio](http://www.garnstudio.com/pattern.php?id=7350&cid=19).",
    "picture" : {
      "type" : "url",
      "url" : "http://www.garnstudio.com/drops/mag/167/17/17-lp.jpg"
    }
  },
  "patterns" : [
    {
      "name" : "all-instructions", 
      "id" : "A.2", 
      "rows" : [
        {
          "id" : 1,
          "instructions-default": {
            "color": "#0000ff"
          },
          "instructions" : [
            {"type" : "bo"},
            {"type" : "cdd"},
            {"type" : "co"},
            {"type" : "default-unknown"},
            {"type" : "k2tog"},
            {"type" : "knit"},
            {"type" : "purl"},
            {"type" : "skp"},
            {"type" : "yo"}
          ]
        }
      ],
      "connections" : [
      ]
    }
  ]
}

Is this structure good to work upon...?

jainaman224 avatar Feb 26 '17 12:02 jainaman224

It looks good to me!

niccokunzmann avatar Feb 26 '17 12:02 niccokunzmann