def parsemark markplace getvedtypeid pos if getvedtypeid зачетные ведо

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
def parsemark(markplace, getvedtypeid, pos):
if getvedtypeid == 0: # зачетные ведомости
if (re.findall("НЕ", markplace) and re.findall("ЗАЧ", markplace)) or re.findall('НЕТ', markplace) or (
re.findall("-", markplace) and len(markplace) == 1) or re.findall("Н([-_ /.]*)З", markplace):
return 2
if re.findall("ЗАЧ", markplace) or re.findall('ДА', markplace) or re.findall('[+]', markplace):
return 1
return -1
if getvedtypeid == 1: # дифзачетные ведомости
if (re.findall("НЕ", markplace) and re.findall("ЗАЧ", markplace)) or re.findall('НЕТ', markplace) or (
re.findall("-", markplace) and len(markplace) == 1) or re.findall("Н([-_ /.]*)З", markplace):
return 2
if (re.findall("ЗАЧ", markplace) and re.findall("УД", markplace)) or re.findall("3", markplace):
return 3
if (re.findall("ЗАЧ", markplace) and re.findall("ХОР", markplace)) or re.findall("4", markplace):
return 4
if (re.findall("ЗАЧ", markplace) and re.findall("ОТЛ", markplace)) or re.findall("5", markplace):
return 5
return -1
if getvedtypeid == 2 and pos == 1: # сдано / не сдано
if (re.findall("НЕ", markplace) and re.findall("СД", markplace)) or re.findall('НЕТ', markplace) or (
re.findall("-", markplace) and len(markplace) == 1) or re.findall("Н([-_ /.]*)С", markplace) or (
re.findall('ДОП', markplace) and re.findall('НЕ', markplace)):
return 9
if (re.findall("СД", markplace) and not re.findall('НЕ', markplace)) or re.findall('[+]',
markplace) or re.findall(
'ДА', markplace) or (re.findall('ДОП', markplace) and not re.findall('НЕ', markplace)):
return 8
return -1
if getvedtypeid == 2 and pos == 2: # экзамен / оценки
if (re.findall("НЕ", markplace) and re.findall("ДОП", markplace)) or re.search("Н([-_ /.]*)Д", markplace):
return 10
if (re.findall("НЕ", markplace) and re.findall("ЯВ", markplace)) or re.search("Н([-_ /.]*)Я", markplace):
return 11
if (re.findall("УД", markplace) and re.findall("НЕ", markplace)) or re.findall("2", markplace) or re.findall(
"ДВА", markplace):
return 12
if re.findall("УД", markplace) or re.findall("3", markplace) or re.findall("ТРИ", markplace):
return 13
if re.findall("ХОР", markplace) or re.findall("4", markplace) or re.findall("ЧЕТ", markplace):
return 14
if re.findall("ОТЛ", markplace) or re.findall("5", markplace) or re.findall("ПЯТ", markplace):
return 15
return -1
if getvedtypeid == 3 or getvedtypeid == 4: # КП КР
if re.findall("УД", markplace) or re.findall("3", markplace):
return 13
if re.findall("ХОР", markplace) or re.findall("4", markplace):
return 14
if re.findall("ОТЛ", markplace) or re.findall("5", markplace):
return 15
if re.findall("НЕ", markplace) or re.findall("2", markplace):
return 16
return -1