|
|
|
@ -22,6 +22,12 @@
|
|
|
|
|
<details open> |
|
|
|
|
<summary>Начальные данные</summary> |
|
|
|
|
<div> |
|
|
|
|
<p> |
|
|
|
|
<label>Номер шага:</label> |
|
|
|
|
<input id = "step_id" type="number" value="0" step="1"/> |
|
|
|
|
</p> |
|
|
|
|
|
|
|
|
|
<p> |
|
|
|
|
<label>Входные данные:<br/></label> |
|
|
|
|
<textarea id="input_data" cols="40" rows="5"></textarea> |
|
|
|
|
<p>Данные должны быть в таком формате:<br/> |
|
|
|
@ -33,12 +39,16 @@
|
|
|
|
|
второе - имя посетителя<br/> |
|
|
|
|
третье - номера участников, с которыми посетитель уже знаком<br/> |
|
|
|
|
</p> |
|
|
|
|
</p> |
|
|
|
|
</div> |
|
|
|
|
<div> |
|
|
|
|
<p id="meet_table" class="text-center"></p> |
|
|
|
|
<button id="load_data">Загрузить</button> |
|
|
|
|
</div> |
|
|
|
|
</details> |
|
|
|
|
<details open> |
|
|
|
|
<summary>Таблица знакомств</summary> |
|
|
|
|
<div> |
|
|
|
|
<button id="load_data">Загрузить</button> |
|
|
|
|
<p id="meet_table" class="text-center"></p> |
|
|
|
|
</div> |
|
|
|
|
</details> |
|
|
|
|
<details> |
|
|
|
@ -67,12 +77,17 @@
|
|
|
|
|
</details> |
|
|
|
|
<details> |
|
|
|
|
<summary>Конечные данные</summary> |
|
|
|
|
<label>Входные данные:<br/></label> |
|
|
|
|
<label>Входные данные для нового шага:<br/></label> |
|
|
|
|
<textarea id="output_data" cols="40" rows="5"></textarea> |
|
|
|
|
<div> |
|
|
|
|
<button id="load_to_start_data">Скопировать во входные данные</button> |
|
|
|
|
<button id="next_step">Перейти на следующий шаг</button> |
|
|
|
|
</div> |
|
|
|
|
</details> |
|
|
|
|
<details> |
|
|
|
|
<summary>Полная таблица всех шагов</summary> |
|
|
|
|
<label>Входные данные:<br/></label> |
|
|
|
|
<textarea id="all_output_data" cols="40" rows="25"></textarea> |
|
|
|
|
</details> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/python"> |
|
|
|
@ -107,6 +122,9 @@ persons = []
|
|
|
|
|
global tables |
|
|
|
|
tables = [] |
|
|
|
|
|
|
|
|
|
def add_to_all_data(val): |
|
|
|
|
document["all_output_data"].value += "\n\n#Шаг " + document["step_id"].value + "\n" + val |
|
|
|
|
|
|
|
|
|
def load_input(val): |
|
|
|
|
global persons |
|
|
|
|
persons = [] |
|
|
|
@ -135,9 +153,13 @@ def get_present_persons():
|
|
|
|
|
|
|
|
|
|
def show_meet_table_data(): |
|
|
|
|
global persons |
|
|
|
|
|
|
|
|
|
html = "Всего участников: " + str(len(persons)) + "<br/>" |
|
|
|
|
html += "Присутсвуют участников: " + str(len(get_present_persons())) + "<br/>" |
|
|
|
|
|
|
|
|
|
html += "Шаг: " + document["step_id"].value + "<br/>" |
|
|
|
|
|
|
|
|
|
meet_count = 0; |
|
|
|
|
html += "<table border = 1>" |
|
|
|
|
# Первая строка |
|
|
|
|
html += "<tr>" |
|
|
|
@ -152,10 +174,14 @@ def show_meet_table_data():
|
|
|
|
|
for ip in persons: |
|
|
|
|
if abs(p.beig_id) in ip.meet_set: |
|
|
|
|
html += "<td bgcolor='red'></td>" |
|
|
|
|
meet_count += 1 |
|
|
|
|
else: |
|
|
|
|
html += "<td></td>" |
|
|
|
|
html += "</tr>" |
|
|
|
|
html += "</table>" |
|
|
|
|
|
|
|
|
|
html += "<br/>Знакомств: " + str(meet_count) + "/" + str(len(persons)**2) + "<br/>" |
|
|
|
|
|
|
|
|
|
document["meet_table"].innerHTML = html |
|
|
|
|
|
|
|
|
|
def get_result(): |
|
|
|
@ -168,6 +194,16 @@ def get_result():
|
|
|
|
|
result += "\n" |
|
|
|
|
return result |
|
|
|
|
|
|
|
|
|
def result_table_fill(): |
|
|
|
|
global tables |
|
|
|
|
result_txt = "" |
|
|
|
|
for t in tables: |
|
|
|
|
result_txt += str(t.id) + ";" |
|
|
|
|
if len(t.person_set): |
|
|
|
|
result_txt += str(t.person_set) |
|
|
|
|
result_txt += "\n" |
|
|
|
|
return result_txt |
|
|
|
|
|
|
|
|
|
def print_result_table(): |
|
|
|
|
table_names = document["table_name"].value |
|
|
|
|
|
|
|
|
@ -194,15 +230,8 @@ def print_result_table():
|
|
|
|
|
html += "</tr>" |
|
|
|
|
html += "</table>" |
|
|
|
|
document["result_table"].innerHTML = html |
|
|
|
|
|
|
|
|
|
result_txt = "" |
|
|
|
|
for t in tables: |
|
|
|
|
result_txt += str(t.id) + ";" |
|
|
|
|
if len(t.person_set): |
|
|
|
|
result_txt += str(t.person_set) |
|
|
|
|
result_txt += "\n" |
|
|
|
|
|
|
|
|
|
document["result_table_txt"].value = result_txt |
|
|
|
|
|
|
|
|
|
document["result_table_txt"].value = result_table_fill() |
|
|
|
|
|
|
|
|
|
def get_person_by_id(id): |
|
|
|
|
global persons |
|
|
|
@ -316,28 +345,39 @@ def make_result():
|
|
|
|
|
fill_persons() |
|
|
|
|
|
|
|
|
|
def load_data(event): |
|
|
|
|
load_input(document["input_data"].value) |
|
|
|
|
val = document["input_data"].value |
|
|
|
|
load_input(val) |
|
|
|
|
add_to_all_data("#Таблица знакомств\n" + val) |
|
|
|
|
show_meet_table_data() |
|
|
|
|
|
|
|
|
|
def table_distrib(event): |
|
|
|
|
load_data(event) |
|
|
|
|
load_input(document["input_data"].value) |
|
|
|
|
make_result() |
|
|
|
|
print_result_table() |
|
|
|
|
document["output_data"].value = get_result() |
|
|
|
|
show_meet_table_data() |
|
|
|
|
|
|
|
|
|
def table_distrib_load(event): |
|
|
|
|
load_data(event) |
|
|
|
|
load_input(document["input_data"].value) |
|
|
|
|
load_input_table(document["result_table_txt"].value) |
|
|
|
|
fill_persons() |
|
|
|
|
print_result_table() |
|
|
|
|
document["output_data"].value = get_result() |
|
|
|
|
show_meet_table_data() |
|
|
|
|
|
|
|
|
|
def load_to_start_data(event): |
|
|
|
|
document["input_data"].value = document["output_data"].value |
|
|
|
|
def next_step(event): |
|
|
|
|
document["step_id"].value = str(int(document["step_id"].value) + 1) |
|
|
|
|
|
|
|
|
|
val = document["output_data"].value |
|
|
|
|
document["input_data"].value = val |
|
|
|
|
load_input(val) |
|
|
|
|
add_to_all_data("#Столы\n" + result_table_fill()) |
|
|
|
|
add_to_all_data("#Таблица знакомств\n" + val) |
|
|
|
|
show_meet_table_data() |
|
|
|
|
|
|
|
|
|
document["load_data"].bind("click", load_data) |
|
|
|
|
document["table_distrib"].bind("click", table_distrib) |
|
|
|
|
document["load_to_start_data"].bind("click", load_to_start_data) |
|
|
|
|
document["next_step"].bind("click", next_step) |
|
|
|
|
document["table_distrib_load"].bind("click", table_distrib_load) |
|
|
|
|
|
|
|
|
|
</script> |
|
|
|
|