bartneck / swiML

A project to formalise swimming programs using XML
MIT License
2 stars 2 forks source link

continueLength is not used in the XSLT and could be removed #106

Closed bartneck closed 2 months ago

bartneck commented 4 months ago

The <continueLength> element is used in the xsd schema and in some assertions. But it is not used in the xsl file. If it is no longer used then it should be removed.

calloc262 commented 4 months ago

I had been using this tag so that you can write a 200 as 50fr 50bk but set continueLength to 200 rather than writing 50fr 50bk 50fr 50bk, however, this hasn't been translated over to the xslt, and isn't used in the length calculating function. I could either add this so that the length will be calculated correctly, or remove the continueLength which would mean the 200 is represented as 2x(50fr 50bk) which still makes sense.

bartneck commented 4 months ago

I am happy to keep it in, but I suspect that it then needs to be used in the XSLT. I would need a detailed explanation of how exactly this works. I am busy writing the documentation, so all these questions come up.

bartneck commented 4 months ago

Could you please keep it and explain how exactly it works?

calloc262 commented 4 months ago

By setting the continueLength of a continue to something larger than what its contents actually are you are expecting the contents of the continue to repeat. Instead of writing a continue as 50fr 50bk 50fr 50bk which would be swum as a 200, you set continueLength to 200 then the contents of the continue will just be 50fr 50bk, which the swimmers would then repeat to get to the total length of 200.

bartneck commented 4 months ago

Thanks for the documentation. I created an example to test the <continueLength> element. It is available here:

/bookExamples/swiML-documentation/continueLength.xml

When giving this instruction:

    <instruction>
        <continue>
            <continueLength>200</continueLength>
            <instruction>
                <length>
                    <lengthAsDistance>50</lengthAsDistance>
                </length>
                <stroke>
                    <standardStroke>freestyle</standardStroke>
                </stroke>
            </instruction>
            <instruction>
                <length>
                    <lengthAsDistance>50</lengthAsDistance>
                </length>
                <stroke>
                    <standardStroke>backstroke</standardStroke>
                </stroke>
            </instruction>
        </continue>
    </instruction>

I get this unexpected result:

SCR-20240520-jzcg

Could you please enable the <continueLength> element?

calloc262 commented 4 months ago

Should be working now

bartneck commented 4 months ago

Yes, this error is now gone, but the calculation of the total length is still wrong. In the example file, the total should be 300, not 200.

Screenshot 2024-05-24 at 9 40 42 AM
bartneck commented 4 months ago

For consistency reasons and to be able to express different types of length, the <continueLength> element should be treated the same way as the <length> element. It should include <lengthAsDistance>, <lengthAsLaps> and <lengthAsTime>. It should also be assured that the unit used is compatible with the instructions included. The easiest would be to ensure that they all use the same unit.

bartneck commented 4 months ago

This error occurs again not in the program length, but in the calculation of the simplified repetition. Have a look at the file jasiMasters/JasiMasters2024041401.xml

SCR-20240528-kbqs

The two enclosed continue elements are summed up to only 50 meters although the continueLength is set to 100.

bartneck commented 2 months ago

tested and okay.