C2LC-604: A loop with 0 iterations is not serialized properly

Metadata

Source
C2LC-604
Type
Bug
Priority
N/A
Status
Done
Resolution
N/A
Assignee
N/A
Reporter
Michelle D'Souza
Created
2022-02-24T09:18:48.939-0500
Updated
2022-02-24T13:57:36.074-0500
Versions
N/A
Fixed Versions
  1. Coding Env 1.2
Component
  1. Coding Environment

Description

iI’s likely due to this line in ProgramSerializer:

if (program[i].iterations && program[i].label) {

https://github.com/codelearncreate/c2lc-coding-environment/blob/0ac4c992d8d16095d763a8e68127ef6658b24f3c/src/ProgramSerializer.js#L57

The number 0 is falsey in JavaScript. So a startLoop with 0 iterations will fail this test and the code to serialize the label and iterations will be skipped.