def modify_template_content()

in functions/source/job-creation/job_creation.py [0:0]


def modify_template_content(template, tablekeys):
    """
    Ground Truth has limitation on the number of nested loops. Correct that.

    """
    section = '''
        <div class="card-body encounter-table {date}">
            <label>Information for blood collection on {date}</label>
            <div id="table" name="table" class="table-editable">
                <table class="table table-bordered table-responsive-md
                     table-striped text-left main-table">
                    <tbody>
                        $3 for field in task.input.table.{date} $4
                            <tr>
                                <td  class="text-left">$1 field[0] $2</td>
                                <td class="pt-3-half" name=$1 field[0] $2
                                 contenteditable="true">$1 field[1] $2</td>
                            </tr>
                        $3 endfor $4
                    </tbody>
                </table>
            </div>
        </div>
        '''
    html = ''
    for collection_date in tablekeys:
        html = ''.join((html, section.format(**{'date': collection_date})))

    html = html.replace('$3', '{%').replace('$4', '%}').\
        replace('$1', '{{').replace('$2', '}}')
    template = template.replace('@@table@@', html)

    return template