Код: Выделить всё
TypeError: '>' not supported between instances of 'ai.timefold.jpyinterpreter.types.datetime.PythonDate' and 'datetime.date'
< /code>
При использовании этого ограничения: < /p>
def teacher_soft(constraint_factory: ConstraintFactory):
return constraint_factory.for_each(Exam) \
.filter(
lambda e:
e.teacher != None and
e.timeslot and (
_search("Doe",exam.teacher)!=None and (
exam.timeslot.start_time.date() > datetime.date(2025,2,10)
)
-- ...
У меня была аналогичная ошибка с сравнением STR, которые я мог бы Решить путем обеспечения соблюдения str (x) на Pythonstring , однако это кажется более сложным. меры, например, создание моего собственного PythonateTimeTimeset класса?
Код: Выделить всё
class Timeslot:
id : Annotated[int, PlanningId]
start_time : datetime.datetime
end_time : datetime.datetime
grain:datetime.timedelta = datetime.timedelta(hours=2)
time_max=datetime.time.max
...
@planning_entity
class Exam:
id: Annotated[int,PlanningId]
subject: str
teacher: str
participants: int
pinned : Annotated[bool, PlanningPin]
timeslot : Annotated[Timeslot | None,
PlanningVariable]
Подробнее здесь: https://stackoverflow.com/questions/793 ... tetime-set
Мобильная версия