@@ -44,10 +44,24 @@ def get_description(self):
44
44
return self .description
45
45
46
46
def get_duration (self ):
47
- return self .duration .seconds // 3600
47
+ total_seconds = self .duration .total_seconds ()
48
+ if total_seconds >= 86400 : # 1 day = 86400 seconds
49
+ days = total_seconds // 86400
50
+ return f"{ days } day{ 's' if days > 1 else '' } "
51
+ elif total_seconds >= 3600 : # 1 hour = 3600 seconds
52
+ hours = total_seconds // 3600
53
+ return f"{ hours } hour{ 's' if hours > 1 else '' } "
54
+ elif total_seconds >= 60 : # 1 minute = 60 seconds
55
+ minutes = total_seconds // 60
56
+ return f"{ minutes } minute{ 's' if minutes > 1 else '' } "
57
+ else :
58
+ return f"{ total_seconds } second{ 's' if total_seconds > 1 else '' } "
48
59
49
60
def get_price (self ):
50
- return self .price
61
+ if self .price == 0 :
62
+ return "Free"
63
+ else :
64
+ return f"{ self .price } { self .currency } "
51
65
52
66
def get_down_payment (self ):
53
67
return self .down_payment
@@ -249,16 +263,25 @@ def set_appointment_paid_status(self, status: bool):
249
263
250
264
class Config (models .Model ):
251
265
slot_duration = models .PositiveIntegerField (
252
- default = 30 ,
253
- help_text = _ ("Duration of each slot in minutes" ),
266
+ null = True ,
267
+ help_text = _ ("Minimum time for an appointment in minutes, recommended 30. " ),
254
268
)
255
269
lead_time = models .TimeField (
256
- default = "09:00" ,
257
- help_text = _ ("Time when slots start" ),
270
+ null = True ,
271
+ help_text = _ ("Time when we start working. " ),
258
272
)
259
273
finish_time = models .TimeField (
260
- default = "16:30" ,
261
- help_text = _ ("Time when we stop working" ),
274
+ null = True ,
275
+ help_text = _ ("Time when we stop working." ),
276
+ )
277
+ appointment_buffer_time = models .DurationField (
278
+ null = True ,
279
+ help_text = _ ("Time between now and the first available slot for the current day (doesn't affect tomorrow)." ),
280
+ )
281
+ website_name = models .CharField (
282
+ max_length = 255 ,
283
+ default = "" ,
284
+ help_text = _ ("Name of your website." ),
262
285
)
263
286
264
287
def clean (self ):
@@ -325,4 +348,4 @@ def generate_code(cls, user):
325
348
code = '' .join (random .choices (string .ascii_uppercase + string .digits , k = 6 ))
326
349
verification_code = cls (user = user , code = code )
327
350
verification_code .save ()
328
- return code
351
+ return code
0 commit comments