Skip to content

Commit

Permalink
Merge pull request #117 from AlexanderBgit/lexxai
Browse files Browse the repository at this point in the history
Compare numbers IN/OUT
  • Loading branch information
RostislavB74 authored Apr 18, 2024
2 parents 46eb6bc + 25330d4 commit 06d3eac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions FRONTEND/fastparking/photos/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import pytz

from ds.predict_num import get_num_auto_png_io
from parking.services import compare_plates

from .models import Photo
from finance.models import Tariff
Expand Down Expand Up @@ -171,6 +172,7 @@ def handle_uploaded_file(
parking_place = registration_result.get("parking_place")
tariff_in = registration_result.get("tariff_in")
invoice = registration_result.get("invoice")
compare_plates_result = registration_result.get("compare_plates")
invoice_str = ""
if invoice:
invoice_str = f"invoice: {invoice},"
Expand All @@ -183,6 +185,7 @@ def handle_uploaded_file(
"parking_place": parking_place,
"tariff_in": tariff_in,
"invoice": invoice,
"compare_plates": compare_plates_result,
"qr_code": qrcode_img,
"date": date_formatted,
"hash": hash_code,
Expand Down Expand Up @@ -330,13 +333,17 @@ def register_parking_out_event(
registration.car_number_out = num_auto
registration.photo_out = photo_id
registration.save()
compare_plates_result = compare_plates(
registration.car_number_in, registration.car_number_out
)
# Free parking space
parking_space_status_change(registration.parking.pk, False)
result = {
"registration_id": registration.pk,
"parking_place": registration.parking.number,
"tariff_in": registration.tariff_in,
"invoice": invoice,
"compare_plates": compare_plates_result,
"info": "Success",
}
except Registration.DoesNotExist as e:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ <h2>RESULT:</h2>
/>
</td>
</tr>
{% if registration.compare_plates %}
<tr {% if not registration.compare_plates.0 %}class="text-danger" {% endif %}>
<th>Compare plates IN/OUT:</th>
<td>{{ registration.compare_plates }}</td>
</tr>
{% endif %}
<tr>
<th>Uniq code:</th>
<td>{{ registration.hash }}</td>
Expand Down

0 comments on commit 06d3eac

Please sign in to comment.