Skip to content

Undefined dates causing ValueErrors #41

@dylms

Description

@dylms

Because start and today dates = None when undefined, creating or changing dates/scales of a project in the treeview occur a ValueError due to None - datetime.datetime objects comparisons in gantt processing.

Traceback (most recent call last):
  File "planning\gui\centralwidget.py", line 241, in <lambda>
  File "planning\gui\centralwidget.py", line 320, in update_planning_charts
  File "planning\model.py", line 1807, in generate_current_chart
  File "planning\model.py", line 795, in make_svg
  File "planning\gantt.py", line 2724, in make_svg_for_resources
  File "planning\gantt.py", line 2142, in _svg_calendar
TypeError: '>=' not supported between instances of 'NoneType' and 'datetime.date'

{C:\Users\...\proj\PyPlanning_base\planning\utils\qthelpers.py:161} CRITICAL - Unhandled exception
Traceback (most recent call last):
  File "C:\Users\...\proj\PyPlanning_base\planning\gui\centralwidget.py", line 237, in <lambda>
    lambda _ditem: self.update_planning_charts(self.planning)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\...\proj\PyPlanning_base\planning\gui\centralwidget.py", line 314, in update_planning_charts
    planning.generate_current_chart(index)
  File "C:\Users\...\proj\PyPlanning_base\planning\model.py", line 1764, in generate_current_chart
    chart.make_svg(project, one_line_for_tasks)
  File "C:\Users\...\proj\PyPlanning_base\planning\model.py", line 785, in make_svg
    project.make_svg_for_tasks(
  File "C:\Users\...\proj\PyPlanning_base\planning\gantt.py", line 2382, in make_svg_for_tasks
    dwg.add(self._svg_calendar(maxx, pheight, start_date, today, scale, offset=offset, t0mode=t0mode))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\...\proj\PyPlanning_base\planning\gantt.py", line 2055, in _svg_calendar
    is_it_today = today >= jour and today < jour_dapres
                  ^^^^^^^^^^^^^
TypeError: '>=' not supported between instances of 'NoneType' and 'datetime.date'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions