noor122 commited on
Commit
d9c8b89
ยท
verified ยท
1 Parent(s): 9962c57

Delete current_pricing.py

Browse files
Files changed (1) hide show
  1. current_pricing.py +0 -48
current_pricing.py DELETED
@@ -1,48 +0,0 @@
1
- from datetime import datetime, timedelta
2
-
3
- def calculate_live_parking(log_in_time, log_out_time, hourly_price):
4
- # ู„ูˆ ู…ููŠุด ูˆู‚ุช ุฏุฎูˆู„
5
- if not log_in_time:
6
- return "0h 0m", float(hourly_price)
7
-
8
- # ู†ุดูŠู„ ุงู„ู€ Timezone ู„ูˆ ู…ูˆุฌูˆุฏ
9
- if log_in_time.tzinfo:
10
- log_in_time = log_in_time.replace(tzinfo=None)
11
-
12
- # =======================================================
13
- # ๐Ÿ’ก ุงู„ุชุนุฏูŠู„ ุงู„ุณุญุฑูŠ: ู‡ู„ ู†ุนุฏ ู„ุงูŠู ูˆู„ุง ู†ุซุจุช ุงู„ูˆู‚ุชุŸ
14
- # =======================================================
15
- if log_out_time:
16
- # ู„ูˆ ููŠู‡ ูˆู‚ุช ุฎุฑูˆุฌ (ูŠุนู†ูŠ ุงู„ุฎู„ูŠุฉ ู…ุด NULL)ุŒ ู†ุซุจุช ุงู„ุญุณุจุฉ ุนู„ูŠู‡
17
- if log_out_time.tzinfo:
18
- log_out_time = log_out_time.replace(tzinfo=None)
19
- end_time = log_out_time
20
- else:
21
- # ู„ูˆ ุงู„ุฎู„ูŠุฉ ู„ุณู‡ NULLุŒ ู†ุญุณุจ ุนู„ู‰ ุชูˆู‚ูŠุช ุฏู„ูˆู‚ุชูŠ (Live)
22
- end_time = datetime.utcnow() + timedelta(hours=3)
23
- # =======================================================
24
-
25
- # ู†ุญุณุจ ุงู„ูุฑู‚ ุจูŠู†ู‡ู… ุจุงู„ุฏู‚ุงุฆู‚
26
- delta = end_time - log_in_time
27
- total_minutes = int(delta.total_seconds() // 60)
28
-
29
- if total_minutes <= 0:
30
- return "0h 0m", float(hourly_price)
31
-
32
- hours = total_minutes // 60
33
- mins = total_minutes % 60
34
-
35
- # ู†ุฌู‡ุฒ ุงู„ูˆู‚ุช ูƒู€ Text
36
- time_str = f"{hours}h {mins}m"
37
-
38
- # ู„ูˆุฌูŠูƒ ุงู„ุญุณุงุจ: ูƒุณุฑ ุงู„ู€ 30 ุฏู‚ูŠู‚ุฉ ุจุณุงุนุฉ
39
- billed_hours = hours
40
- if mins >= 30:
41
- billed_hours += 1
42
-
43
- billed_hours = max(1, billed_hours)
44
-
45
- # ุญุณุงุจ ุงู„ุณุนุฑ ุงู„ู†ู‡ุงุฆูŠ
46
- final_price = billed_hours * float(hourly_price)
47
-
48
- return time_str, final_price