Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor chnages #166

Merged
merged 2 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions FRONTEND/fastparking/photos/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def scan_qr_code(image, debug: bool = False) -> str | None:
detector = cv2.QRCodeDetector()
# Detect and decode QR codes
data_qr, bbox, _ = detector.detectAndDecode(gray)
print(f"{data_qr=}")
# print(f"{data_qr=}")
# If QR code is detected, print the data
if data_qr and bbox is not None:
# print("Data:", data)
Expand Down Expand Up @@ -111,7 +111,7 @@ def decode_io_file(f):
if isinstance(f, str):
return cv2.imread(f)
content_type = f.content_type
print(f"{content_type=}")
# print(f"{content_type=}")
if content_type == "application/pdf":
io_buf = read_pdf_image(f.read())
if io_buf is None:
Expand Down
12 changes: 6 additions & 6 deletions FRONTEND/fastparking/photos/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ def scan_qr(request):
if request.method == "POST":
form = UploadScanQRForm(request.POST, request.FILES)
if form.is_valid():
uploaded_file = request.FILES.get("photo")
content_type = None
if uploaded_file:
pass
file_in = request.FILES.get("photo")
if file_in:
filename = file_in.name
Expand All @@ -112,18 +108,22 @@ def scan_qr(request):
qr_info["date"], datetime.datetime
):
qr_info["date"] = qr_info["date"].strftime("%Y-%m-%d %H:%M:%S")
registration_fmt = qr_info.get("id")
if registration_fmt:
TOTAL_DIGITS_ID = settings.TOTAL_DIGITS_ID[1]
registration_fmt = f"{int(registration_fmt):{TOTAL_DIGITS_ID}d}"
info = {
"description": qr_info.get("result"),
"parking_place": qr_info.get("place"),
"date": qr_info.get("date"),
"registration": qr_info.get("id"),
"registration": registration_fmt,
}
context = {
"active_menu": active_menu,
"title": f"Scan QR code result",
"info": info,
}
print(f"{info}")
# print(f"{info}")
if info:
return render(request, "photos/qr_result.html", context)
else:
Expand Down
Loading