<commit_before>{% set active_page='import_conditions'%}{% extends "layout.html" %}
{% block title %}Import organisation conditions{% endblock %}
{% block content %}
    
    <form action="{{url_for('import_organisation_conditions', step=3)}}" 
		  method="post">

    {% if results %}
    <table class="table">
    <thead>
        <th>Import?</th>
		<th>Organisation</th>
		<th>Test</th>
		<th>Operation</th>
		<th>Condition</th>
		<th>Condition value</th>
		<th>Description</th>
    </thead>
    <tbody>
        {% for result in results %}
            {% set num = (loop.index) %}
            {% for test in result.tests %}
            <tr>
            <td><input type="checkbox" name="include" 
					   value="{{num}}{{loop.index}}" checked /></td>
			
            <td><input type="hidden" 
					   name="pc[{{num}}{{loop.index}}][organisation_id]" 
					   value="{{result.organisation.id}}"/>
			  <a href="{{url_for('organisations', 
					   organisation_code=result.organisation.organisation_code)}}">
				{{result.organisation.organisation_name}}</a>
			</td>

            <td><input type="hidden" name="pc[{{num}}{{loop.index}}][test_id]" 
					   value="{{test.id}}"/>
			  <a href="{{url_for('tests', id=test.id)}}">{{test.name}}</a>
			</td>

            <td><input type="hidden" 
					   name="pc[{{num}}{{loop.index}}][operation]" 
					   value="{{result.operation}}"/>
			  {{result.operation}}
			</td>

            <td><input type="hidden" 
					   name="pc[{{num}}{{loop.index}}][condition]" 
					   value="{{result.condition}}"/>
			  {{result.condition}}
			</td>

            <td><input type="hidden" 
					   name="pc[{{num}}{{loop.index}}][condition_value]" 
					   value="{{result.condition_value}}"/>
			  {{result.condition_value}}
			</td>

            <td><input type="hidden" 
					   name="pc[{{num}}{{loop.index}}][description]" 
					   value="{{result.description}}"/>
			  {{result.description}}
			</td>
			</tr>
            {% endfor %}
        {% endfor %}
    <tr>
        <td colspan="7">
		  <input type="submit" value="Add conditions"
				 class="btn btn-success" />
		</td>
    </tr>
    </tbody>
    </table>
    {% endif %}
    </form>
{% endblock %}
<commit_msg>Add table sorter to org condition import table<commit_after>{% set active_page='import_conditions'%}{% extends "layout.html" %}
{% block title %}Import organisation conditions{% endblock %}
{% block content %}
    <script src="{{url_for('static',
         filename='jquery.tablesorter.min.js')}}"></script>

    <script >
    $(function() {
    $("table").tablesorter({ sortList: [[1,0], [2,0]] });
    });
    </script>
    
    <form action="{{url_for('import_organisation_conditions', step=3)}}" 
		  method="post">

    {% if results %}
    <table class="table">
    <thead>
        <th>Import?</th>
		<th>Organisation</th>
		<th>Test</th>
		<th>Operation</th>
		<th>Condition</th>
		<th>Condition value</th>
		<th>Description</th>
    </thead>
    <tbody>
        {% for result in results %}
            {% set num = (loop.index) %}
            {% for test in result.tests %}
            <tr>
            <td><input type="checkbox" name="include" 
					   value="{{num}}{{loop.index}}" checked /></td>
			
            <td><input type="hidden" 
					   name="pc[{{num}}{{loop.index}}][organisation_id]" 
					   value="{{result.organisation.id}}"/>
			  <a href="{{url_for('organisations', 
					   organisation_code=result.organisation.organisation_code)}}">
				{{result.organisation.organisation_name}}</a>
			</td>

            <td><input type="hidden" name="pc[{{num}}{{loop.index}}][test_id]" 
					   value="{{test.id}}"/>
			  <a href="{{url_for('tests', id=test.id)}}">{{test.name}}</a>
			</td>

            <td><input type="hidden" 
					   name="pc[{{num}}{{loop.index}}][operation]" 
					   value="{{result.operation}}"/>
			  {{result.operation}}
			</td>

            <td><input type="hidden" 
					   name="pc[{{num}}{{loop.index}}][condition]" 
					   value="{{result.condition}}"/>
			  {{result.condition}}
			</td>

            <td><input type="hidden" 
					   name="pc[{{num}}{{loop.index}}][condition_value]" 
					   value="{{result.condition_value}}"/>
			  {{result.condition_value}}
			</td>

            <td><input type="hidden" 
					   name="pc[{{num}}{{loop.index}}][description]" 
					   value="{{result.description}}"/>
			  {{result.description}}
			</td>
			</tr>
            {% endfor %}
        {% endfor %}
    </tbody>
    </table>

    <input type="submit" value="Add conditions"
       class="btn btn-success" />

    {% endif %}
    </form>
{% endblock %}

{'fraction_non_alphanumeric': 0.21716514954486346, 'fraction_numerical': 0.001517121803207629, 'mean_word_length': 2.6082877247849883, 'pattern_counts': {'":': 0, '<': 111, '<?xml version=': 0, '>': 111, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4824147', 'n_tokens_mistral': 1765, 'n_tokens_neox': 1449, 'n_words': 232}