Project and Services mailing list archives

project@odoo-community.org

Avatar

Re: [OCA/project] project_task_scheduling: Module for automatic task planning (#419)

by "Eric @ Elico Corp" <notifications@github.com> - 17/08/2018 09:45:49

@elicoidal commented on this pull request.

This module requires proper documentation (functional and technical). As is, it is very difficult to use.


In project_task_assignment/readme/DESCRIPTION.rst:

> @@ -0,0 +1,5 @@
+This module allow you:

add blank line


In project_task_assignment/tests/test_project_task.py:

> @@ -0,0 +1,36 @@
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

use standard short headers


In project_task_assignment/tests/__init__.py:

> @@ -0,0 +1,2 @@
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

no headers in init.py files


In project_task_scheduling/readme/DESCRIPTION.rst:

> @@ -0,0 +1 @@
+This module allow you to execute an automated project task scheduling.

Could you improve the description and add a use case?


In project_task_scheduling/wizards/scheduling_wizard.py:

> +
+    _state_obj = namedtuple('State', (
+        'tasks_list',
+        'tasks_dict',
+        'employees_dict',
+        'evaluation'
+    ))
+    _MAX_HOURS_DELAYED = 1000000
+
+    # fields
+    # ------
+    date_start = fields.Datetime(
+        default=lambda self: self._default_start(),
+        required=True,
+    )
+    cooling_ratio = fields.Float(

Could you add a help message?


In project_task_scheduling/wizards/scheduling_wizard.py:

> +    def _obj_func(self, state):
+        total_hours_dy = task_dy_count = 0
+        for interval in state.tasks_dict.values():
+            if not interval.data.get('assigned', False):
+                task = interval.data['task']
+                deadline = fields.Date.from_string(task.date_deadline)
+                if deadline:
+                    deadline_dt = datetime.combine(deadline, time.max)
+                    delayed_td = (interval.end_datetime - deadline_dt)
+                    total_hours_dy += delayed_td.total_seconds() / 3600.0
+                    is_delayed = interval.data.get('delayed', False)
+                    task_dy_count += 1 if is_delayed else 0
+
+        if total_hours_dy > self._MAX_HOURS_DELAYED:
+            raise ValidationError(_(
+                'Maybe some tasks have a very long "Initially Planned Hours"'

You provide the explanation but not the actual error


In project_task_scheduling/wizards/scheduling_wizard.py:

> +        interval = False
+        index = 0
+        for employee_interval in state.employees_dict.get(employee.id, []):
+            stop = employee_interval.start_datetime
+            if stop > start:
+                interval = self._get_interval(task.planned_hours, employee,
+                                              start, stop)
+                if interval:
+                    break
+            start = max(employee_interval.end_datetime, start)
+            index += 1
+        if not interval:
+            interval = self._get_interval(task.planned_hours, employee, start)
+        return interval, index
+
+    def _greedy_distribution(self, state, init_index=0):

Please add docstrings to all methods


You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.