Skip to content

Commit

Permalink
Исправление: Не работает сигнал по успешном прохождении занятия #200 (#…
Browse files Browse the repository at this point in the history
…216)

Co-authored-by: Konstantin Raikhert <[email protected]>
  • Loading branch information
kudralexandr and KonstantinRaikhert authored Aug 14, 2024
1 parent 61b50a4 commit 59e5d08
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 45 deletions.
42 changes: 24 additions & 18 deletions docs/Goodstart ER diagram.drawio
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<mxfile host="app.diagrams.net" modified="2024-04-24T17:39:53.598Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 YaBrowser/23.3.3.764 Yowser/2.5 Safari/537.36" etag="c4qUVeASUo8TQWPyuryo" version="24.2.8" type="device">
<mxfile host="Electron" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.7.5 Chrome/126.0.6478.183 Electron/31.3.0 Safari/537.36" version="24.7.5">
<diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">
<mxGraphModel dx="2560" dy="959" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<mxGraphModel dx="2261" dy="836" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="WIyWlLk6GJQsqaUBKTNV-1" parent="WIyWlLk6GJQsqaUBKTNV-0" />
Expand Down Expand Up @@ -33,7 +33,7 @@
<mxCell id="1_RxvIfycXl6Vbq58RZe-65" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1.005;exitY=0.11;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;startArrow=ERone;startFill=0;endArrow=ERmany;endFill=0;exitPerimeter=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="1_RxvIfycXl6Vbq58RZe-15" target="1_RxvIfycXl6Vbq58RZe-41" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="NN4d7tkiMxJklWD-fPsq-13" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.25;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;startArrow=ERmany;startFill=0;endArrow=ERmany;endFill=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="1_RxvIfycXl6Vbq58RZe-15" target="NN4d7tkiMxJklWD-fPsq-12">
<mxCell id="NN4d7tkiMxJklWD-fPsq-13" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.25;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;startArrow=ERmany;startFill=0;endArrow=ERmany;endFill=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="1_RxvIfycXl6Vbq58RZe-15" target="NN4d7tkiMxJklWD-fPsq-12" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="1_RxvIfycXl6Vbq58RZe-15" value="Subject" style="swimlane;fontStyle=2;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeLast=0;collapsible=1;marginBottom=0;rounded=0;shadow=0;strokeWidth=1;fillColor=#f5f5f5;fontColor=#333333;strokeColor=#666666;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
Expand All @@ -52,22 +52,22 @@
<mxRectangle x="220" y="120" width="160" height="26" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="NN4d7tkiMxJklWD-fPsq-0" value="telegram id  (Integer)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" vertex="1" parent="1_RxvIfycXl6Vbq58RZe-23">
<mxCell id="NN4d7tkiMxJklWD-fPsq-0" value="telegram id  (Integer)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="1_RxvIfycXl6Vbq58RZe-23" vertex="1">
<mxGeometry y="26" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="NN4d7tkiMxJklWD-fPsq-1" value="name  (Charfield)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" vertex="1" parent="1_RxvIfycXl6Vbq58RZe-23">
<mxCell id="NN4d7tkiMxJklWD-fPsq-1" value="name  (Charfield)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="1_RxvIfycXl6Vbq58RZe-23" vertex="1">
<mxGeometry y="52" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="NN4d7tkiMxJklWD-fPsq-3" value="surname (Charfield)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" vertex="1" parent="1_RxvIfycXl6Vbq58RZe-23">
<mxCell id="NN4d7tkiMxJklWD-fPsq-3" value="surname (Charfield)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="1_RxvIfycXl6Vbq58RZe-23" vertex="1">
<mxGeometry y="78" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="NN4d7tkiMxJklWD-fPsq-4" value="city (Charfield)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" vertex="1" parent="1_RxvIfycXl6Vbq58RZe-23">
<mxCell id="NN4d7tkiMxJklWD-fPsq-4" value="city (Charfield)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="1_RxvIfycXl6Vbq58RZe-23" vertex="1">
<mxGeometry y="104" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="NN4d7tkiMxJklWD-fPsq-5" value="phone number  (Phonefield)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" vertex="1" parent="1_RxvIfycXl6Vbq58RZe-23">
<mxCell id="NN4d7tkiMxJklWD-fPsq-5" value="phone number  (Phonefield)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="1_RxvIfycXl6Vbq58RZe-23" vertex="1">
<mxGeometry y="130" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="NN4d7tkiMxJklWD-fPsq-12" value="subjects (Manytomany)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" vertex="1" parent="1_RxvIfycXl6Vbq58RZe-23">
<mxCell id="NN4d7tkiMxJklWD-fPsq-12" value="subjects (Manytomany)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="1_RxvIfycXl6Vbq58RZe-23" vertex="1">
<mxGeometry y="156" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="1_RxvIfycXl6Vbq58RZe-45" value="study_classes (Manytomany)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="1_RxvIfycXl6Vbq58RZe-23" vertex="1">
Expand All @@ -87,25 +87,25 @@
<mxCell id="1_RxvIfycXl6Vbq58RZe-49" value="parents_contacts (Charfield)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="1_RxvIfycXl6Vbq58RZe-28" vertex="1">
<mxGeometry y="78" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="NN4d7tkiMxJklWD-fPsq-6" value="telegram id  (Integer)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" vertex="1" parent="1_RxvIfycXl6Vbq58RZe-28">
<mxCell id="NN4d7tkiMxJklWD-fPsq-6" value="telegram id  (Integer)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="1_RxvIfycXl6Vbq58RZe-28" vertex="1">
<mxGeometry y="104" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="NN4d7tkiMxJklWD-fPsq-7" value="name  (Charfield)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" vertex="1" parent="1_RxvIfycXl6Vbq58RZe-28">
<mxCell id="NN4d7tkiMxJklWD-fPsq-7" value="name  (Charfield)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="1_RxvIfycXl6Vbq58RZe-28" vertex="1">
<mxGeometry y="130" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="NN4d7tkiMxJklWD-fPsq-8" value="surname (Charfield)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" vertex="1" parent="1_RxvIfycXl6Vbq58RZe-28">
<mxCell id="NN4d7tkiMxJklWD-fPsq-8" value="surname (Charfield)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="1_RxvIfycXl6Vbq58RZe-28" vertex="1">
<mxGeometry y="156" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="NN4d7tkiMxJklWD-fPsq-9" value="city (Charfield)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" vertex="1" parent="1_RxvIfycXl6Vbq58RZe-28">
<mxCell id="NN4d7tkiMxJklWD-fPsq-9" value="city (Charfield)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="1_RxvIfycXl6Vbq58RZe-28" vertex="1">
<mxGeometry y="182" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="NN4d7tkiMxJklWD-fPsq-10" value="phone number  (Phonefield)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" vertex="1" parent="1_RxvIfycXl6Vbq58RZe-28">
<mxCell id="NN4d7tkiMxJklWD-fPsq-10" value="phone number  (Phonefield)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="1_RxvIfycXl6Vbq58RZe-28" vertex="1">
<mxGeometry y="208" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="NN4d7tkiMxJklWD-fPsq-11" value="competence (Manytomany)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" vertex="1" parent="1_RxvIfycXl6Vbq58RZe-28">
<mxCell id="NN4d7tkiMxJklWD-fPsq-11" value="competence (Manytomany)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="1_RxvIfycXl6Vbq58RZe-28" vertex="1">
<mxGeometry y="234" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="1_RxvIfycXl6Vbq58RZe-63" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.994;entryY=0.104;entryDx=0;entryDy=0;startArrow=ERone;startFill=0;endArrow=ERoneToMany;endFill=0;entryPerimeter=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="1_RxvIfycXl6Vbq58RZe-50" edge="1" target="1_RxvIfycXl6Vbq58RZe-23">
<mxCell id="1_RxvIfycXl6Vbq58RZe-63" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.994;entryY=0.104;entryDx=0;entryDy=0;startArrow=ERone;startFill=0;endArrow=ERoneToMany;endFill=0;entryPerimeter=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="1_RxvIfycXl6Vbq58RZe-50" target="1_RxvIfycXl6Vbq58RZe-23" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="280" y="651" />
Expand All @@ -127,7 +127,7 @@
</mxGeometry>
</mxCell>
<mxCell id="1_RxvIfycXl6Vbq58RZe-39" value="Lesson" style="swimlane;fontStyle=2;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeLast=0;collapsible=1;marginBottom=0;rounded=0;shadow=0;strokeWidth=1;fillColor=#f5f5f5;fontColor=#333333;strokeColor=#666666;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="300" y="560" width="180" height="234" as="geometry">
<mxGeometry x="300" y="560" width="180" height="310" as="geometry">
<mxRectangle x="220" y="120" width="160" height="26" as="alternateBounds" />
</mxGeometry>
</mxCell>
Expand All @@ -153,7 +153,13 @@
<mxGeometry y="182" width="180" height="26" as="geometry" />
</mxCell>
<mxCell id="1_RxvIfycXl6Vbq58RZe-55" value="test_lesson (Boolean)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rounded=0;shadow=0;html=0;" parent="1_RxvIfycXl6Vbq58RZe-39" vertex="1">
<mxGeometry y="208" width="180" height="26" as="geometry" />
<mxGeometry y="208" width="180" height="32" as="geometry" />
</mxCell>
<mxCell id="eXRfmXJ0v6oK0QRM7kVE-0" value="is_passed_teacher (Boolean)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rounded=0;shadow=0;html=0;" vertex="1" parent="1_RxvIfycXl6Vbq58RZe-39">
<mxGeometry y="240" width="180" height="30" as="geometry" />
</mxCell>
<mxCell id="eXRfmXJ0v6oK0QRM7kVE-1" value="is_passed_student (Boolean)" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rounded=0;shadow=0;html=0;" vertex="1" parent="1_RxvIfycXl6Vbq58RZe-39">
<mxGeometry y="270" width="180" height="30" as="geometry" />
</mxCell>
<mxCell id="1_RxvIfycXl6Vbq58RZe-61" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=0;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;startArrow=ERmany;startFill=0;endArrow=ERmany;endFill=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="1_RxvIfycXl6Vbq58RZe-58" target="1_RxvIfycXl6Vbq58RZe-45" edge="1">
<mxGeometry relative="1" as="geometry" />
Expand Down
Binary file modified docs/Goodstart ER diagram.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 19 additions & 21 deletions src/bot/handlers/was_the_lesson.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from schooling.models import Lesson
from bot.states import UserStates
from bot.messages_texts.constants import (
UNCOMPLETED_LESSON_FEEDBACK_MSG, COMPLETED_LESSON_MSG,
UNCOMPLETED_LESSON_FEEDBACK_MSG,
SUCCESS_LESSON_MSG,
)

Expand Down Expand Up @@ -63,32 +63,30 @@ async def was_the_lesson_completed(update: Update, context: CallbackContext):
context.user_data['lesson_responses'].get('student_answ')
)

if all([teacher_answ, student_answ]):
if teacher_answ == 'yes':
lesson.is_passed_teacher = True
await lesson.asave()
await query.edit_message_text(
text=SUCCESS_LESSON_MSG,
)

if teacher_answ == 'yes' and student_answ == 'yes':
lesson.is_passed = True
#TODO Проверить установку флага пройденного занятия, неккоректно
await lesson.asave()
await query.edit_message_text(
text=COMPLETED_LESSON_MSG,
)
context.user_data['lesson_responses'].clear()
else:
await no_answ_lesson_response(
query=query,
update=update,
)
context.user_data['lesson_responses'].clear()
if student_answ == 'yes':
lesson.is_passed_student = True
await lesson.asave()
await query.edit_message_text(
text=SUCCESS_LESSON_MSG,
)

if lesson.is_passed_teacher and lesson.is_passed_student:
lesson.is_passed = True
await lesson.asave()
context.user_data['lesson_responses'].clear()

elif teacher_answ == 'no' or student_answ == 'no':
if teacher_answ == 'no' or student_answ == 'no':
await no_answ_lesson_response(
query=query,
update=update,
)

else:
await query.edit_message_text(
text=SUCCESS_LESSON_MSG,
)

lesson_end_handler = CallbackQueryHandler(was_the_lesson_completed)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 5.0.4 on 2024-08-13 10:12

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('schooling', '0009_alter_student_phone_number_and_more'),
]

operations = [
migrations.AddField(
model_name='lesson',
name='is_passed_student',
field=models.BooleanField(default=False, verbose_name='Занятие подтверждено учеником'),
),
migrations.AddField(
model_name='lesson',
name='is_passed_teacher',
field=models.BooleanField(default=False, verbose_name='Занятие подтверждено учителем'),
),
]
6 changes: 6 additions & 0 deletions src/schooling/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ class Lesson(models.Model):
default=45,
)
is_passed = models.BooleanField('Занятие прошло', default=False)
is_passed_teacher = models.BooleanField(
'Занятие подтверждено учителем', default=False,
)
is_passed_student = models.BooleanField(
'Занятие подтверждено учеником', default=False,
)
test_lesson = models.BooleanField('Пробное занятие', default=False)

class Meta:
Expand Down
Loading

0 comments on commit 59e5d08

Please sign in to comment.