[Planner Dev] Patch for Planner Bugzilla 137544 for Task priority spinner not effective.
- From: "lincoln phipps openmutual net" <lincoln phipps openmutual net>
- To: Planner Project Manager - Development List <planner-dev lists imendio com>
- Subject: [Planner Dev] Patch for Planner Bugzilla 137544 for Task priority spinner not effective.
- Date: Tue, 06 Apr 2004 01:28:33 +0100
OK - I've given in and will chop my patches into smaller
things. I've just got a lot more familiar with using
patch to reverse patches. It works very well.
Attached is the Task priority patch. This fixes,
http://bugzilla.gnome.org/show_bug.cgi?id=137544
(Task priority spinner not effective.)
The priority spinner is now effective and gets stored.
It was always displayed but never used (I guess never
worked in MrProject or Planner). Range is quite
arbitarily set to 0..9999. In the future I'd expect
0 to imply no priority defined and 1..9999 to mean a
priority. FYI: MS Project 2000 has priority values
from 1 to 1000 so we're able to map to/from that as well
as potentially have a finer grain when within our own
environment.
As to wether 1 is high or low is up to the user at this
time; planner doesn't use this in any scheduling.
WARNING: this changes schema. An old Planner will
not read any new files which have "priority" in
them (This isn't a bug but how Planner works in its
backward compatibility stuff).
Why is this important ? - well Planner doesn't have
an internal load leveller but there are a number of
external ones and people have expressed some interest
in external scheduling. You could use the priority
field to help tweak how these 3rd party rank tasks
for scheduling.
Note as mentioned: Planner doesn't yet use this field.
Its for discussion - but planner could use this field
in the future e.g. if you have TASK 1,2,3 and TASK2 and
3 are both linked to TASK 1 as FS and both use the same
set of resources which are now at MAX (100%) then the
"higher" priority task out of 2 or 3 should take precedence
over the "lower" priority task. But as we know this
isn't as easy as it sounds :) but having a priority
field is certainly a very helpful hint to any scheduler
as its defined by the Project Manager (human) and they
are the best arbitrator of precedence in the end.
Rgds,
Lincoln.
Index: data/dtd/mrproject-0.6.dtd
===================================================================
RCS file: /cvs/gnome/planner/data/dtd/mrproject-0.6.dtd,v
retrieving revision 1.2
diff -u -b -B -p -r1.2 mrproject-0.6.dtd
--- data/dtd/mrproject-0.6.dtd 15 Mar 2004 21:02:17 -0000 1.2
+++ data/dtd/mrproject-0.6.dtd 5 Apr 2004 23:59:26 -0000
@@ -59,6 +59,7 @@ Note: A mistake in the format design led
duration CDATA #IMPLIED
work CDATA #IMPLIED
percent-complete CDATA #IMPLIED
+ priority CDATA #IMPLIED
type (normal|milestone) "normal"
scheduling (fixed-work|
fixed-duration) "fixed-work">
Index: data/glade/task-dialog.glade
===================================================================
RCS file: /cvs/gnome/planner/data/glade/task-dialog.glade,v
retrieving revision 1.3
diff -u -b -B -p -r1.3 task-dialog.glade
--- data/glade/task-dialog.glade 15 Mar 2004 22:27:13 -0000 1.3
+++ data/glade/task-dialog.glade 5 Apr 2004 23:59:28 -0000
@@ -271,7 +271,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">1 0 100 1 10 10</property>
+ <property name="adjustment">0 0 9999 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
Index: data/stylesheets/html1_css.xsl
===================================================================
RCS file: /cvs/gnome/planner/data/stylesheets/html1_css.xsl,v
retrieving revision 1.3
diff -u -b -B -p -r1.3 html1_css.xsl
--- data/stylesheets/html1_css.xsl 18 Mar 2004 14:35:59 -0000 1.3
+++ data/stylesheets/html1_css.xsl 5 Apr 2004 23:59:28 -0000
@@ -318,6 +318,11 @@ TD.task-date .time {
TD.task-work { }
+TD.task-priority {
+ font-size: 9pt;
+ text-align: center;
+}
+
TD.task-note {
font-size: 9pt;
}
Index: data/stylesheets/html1_tasks.xsl
===================================================================
RCS file: /cvs/gnome/planner/data/stylesheets/html1_tasks.xsl,v
retrieving revision 1.1.1.1
diff -u -b -B -p -r1.1.1.1 html1_tasks.xsl
--- data/stylesheets/html1_tasks.xsl 1 Dec 2003 17:36:55 -0000 1.1.1.1
+++ data/stylesheets/html1_tasks.xsl 5 Apr 2004 23:59:28 -0000
@@ -30,6 +30,7 @@
<th align="left" class="tasks-hdr">Start</th>
<th align="left" class="tasks-hdr">End</th>
<th align="left" class="tasks-hdr">Work</th>
+ <th align="left" class="tasks-hdr">Priority</th>
<th align="left" class="tasks-hdr">Resources</th>
<xsl:if test="$hasproperties">
<th align="left" class="tasks-hdr">Properties</th>
@@ -150,6 +151,9 @@
<xsl:call-template name="mrproj-duration">
<xsl:with-param name="duration" select="substring (date:duration ((3600 * @work) div 1200),2)"/>
</xsl:call-template>
+ </td>
+ <td class="task-priority">
+ <xsl:value-of select="format-number(@priority, '0')"/>
</td>
<td class="task-resources">
<xsl:for-each select="/project/allocations/allocation[ task-id=$tid]">
Index: docs/sql/database-0.11.sql
===================================================================
RCS file: /cvs/gnome/planner/docs/sql/database-0.11.sql,v
retrieving revision 1.1
diff -u -b -B -p -r1.1 database-0.11.sql
--- docs/sql/database-0.11.sql 15 Mar 2004 21:02:21 -0000 1.1
+++ docs/sql/database-0.11.sql 5 Apr 2004 23:59:29 -0000
@@ -155,12 +155,14 @@ CREATE TABLE task (
work integer DEFAULT 0,
duration integer DEFAULT 0,
percent_complete integer DEFAULT 0,
+ priority integer DEFAULT 0,
is_milestone boolean NOT NULL DEFAULT FALSE,
is_fixed_work boolean NOT NULL DEFAULT TRUE,
constraint_type text NOT NULL DEFAULT 'ASAP',
constraint_time timestamp with time zone,
CHECK (constraint_type = 'ASAP' OR constraint_type = 'MSO' OR constraint_type = 'FNLT' OR constraint_type = 'SNET'),
CHECK (percent_complete > -1 AND percent_complete < 101),
+ CHECK (priority > -1 AND priority < 10000),
FOREIGN KEY (proj_id) REFERENCES project (proj_id)
ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (parent_id) REFERENCES task (task_id)
Index: docs/sql/upgrade-0.6.x-0.11.sql
===================================================================
RCS file: /cvs/gnome/planner/docs/sql/upgrade-0.6.x-0.11.sql,v
retrieving revision 1.1
diff -u -b -B -p -r1.1 upgrade-0.6.x-0.11.sql
--- docs/sql/upgrade-0.6.x-0.11.sql 15 Mar 2004 21:02:21 -0000 1.1
+++ docs/sql/upgrade-0.6.x-0.11.sql 5 Apr 2004 23:59:29 -0000
@@ -1,12 +1,15 @@
--- Planner Database Schema Upgrade from 0.6.x to 0.7
+-- Planner Database Schema Upgrade from 0.6.x to 0.11
-- Lincoln Phipps <lincoln phipps openmutual net>
-- Copyright 2004 Lincoln Phipps
--
--- Resource Schema Changes from 0.6.x to 0.7
+-- Resource Schema Changes from 0.6.x to 0.11
--
-ALTER TABLE resource ADD COLUMN short_name text
+ALTER TABLE resource ADD COLUMN short_name text;
+ALTER TABLE task ADD COLUMN priority integer;
+ALTER TABLE task ALTER COLUMN priority SET DEFAULT 0;
+ALTER TABLE task ADD CHECK (priority > -1 AND priority < 10000);
Index: docs/user-guide/C/planner.xml
===================================================================
RCS file: /cvs/gnome/planner/docs/user-guide/C/planner.xml,v
retrieving revision 1.1.1.1
diff -u -b -B -p -r1.1.1.1 planner.xml
--- docs/user-guide/C/planner.xml 1 Dec 2003 17:36:26 -0000 1.1.1.1
+++ docs/user-guide/C/planner.xml 5 Apr 2004 23:59:31 -0000
@@ -830,7 +830,8 @@
<listitem>
<para><guilabel>Priority</guilabel> - sets a priority for the task. There is no
specific functionality tied to this field at the moment. It is informational
- only</para>
+ only. The default value is 0 and ranges from 0-9999. Note that this was only
+ saved in Planner versions older than Planner v0.11.</para>
</listitem>
</itemizedlist>
<figure>
Index: libplanner/mrp-old-xml.c
===================================================================
RCS file: /cvs/gnome/planner/libplanner/mrp-old-xml.c,v
retrieving revision 1.3
diff -u -b -B -p -r1.3 mrp-old-xml.c
--- libplanner/mrp-old-xml.c 25 Mar 2004 23:19:20 -0000 1.3
+++ libplanner/mrp-old-xml.c 5 Apr 2004 23:59:33 -0000
@@ -212,6 +212,7 @@ old_xml_read_task (MrpParser *parser, xm
MrpTask *task;
MrpConstraint constraint;
guint percent_complete = 0;
+ gint priority = 0;
gchar *note;
gint duration, work;
gboolean got_constraint = FALSE;
@@ -227,6 +228,7 @@ old_xml_read_task (MrpParser *parser, xm
note = old_xml_get_string (tree, "note");
id = old_xml_get_int (tree, "id");
percent_complete = old_xml_get_int (tree, "percent-complete");
+ priority = old_xml_get_int (tree, "priority");
type = old_xml_get_task_type (tree, "type");
sched = old_xml_get_task_sched (tree, "scheduling");
@@ -250,6 +252,7 @@ old_xml_read_task (MrpParser *parser, xm
"name", name,
"duration", duration,
"percent_complete", percent_complete,
+ "priority", priority,
"note", note,
NULL);
} else {
@@ -284,6 +287,7 @@ old_xml_read_task (MrpParser *parser, xm
"work", work,
"duration", duration,
"percent_complete", percent_complete,
+ "priority", priority,
"note", note,
NULL);
}
Index: libplanner/mrp-parser.c
===================================================================
RCS file: /cvs/gnome/planner/libplanner/mrp-parser.c,v
retrieving revision 1.2
diff -u -b -B -p -r1.2 mrp-parser.c
--- libplanner/mrp-parser.c 15 Mar 2004 21:02:22 -0000 1.2
+++ libplanner/mrp-parser.c 5 Apr 2004 23:59:34 -0000
@@ -484,6 +484,7 @@ mpp_write_task_cb (MrpTask *task, MrpPar
gint duration;
gint work;
gint complete;
+ gint priority;
MrpTaskType type;
MrpTaskSched sched;
GList *predecessors, *l;
@@ -512,6 +513,7 @@ mpp_write_task_cb (MrpTask *task, MrpPar
"work", &work,
"constraint", &constraint,
"percent-complete", &complete,
+ "priority", &priority,
"type", &type,
"sched", &sched,
NULL);
@@ -535,6 +537,8 @@ mpp_write_task_cb (MrpTask *task, MrpPar
mpp_xml_set_date (node, "end", finish);
mpp_xml_set_int (node, "percent-complete", complete);
+
+ mpp_xml_set_int (node, "priority", priority);
mpp_xml_set_task_type (node, "type", type);
Index: libplanner/mrp-sql.c
===================================================================
RCS file: /cvs/gnome/planner/libplanner/mrp-sql.c,v
retrieving revision 1.3
diff -u -b -B -p -r1.3 mrp-sql.c
--- libplanner/mrp-sql.c 15 Mar 2004 21:02:22 -0000 1.3
+++ libplanner/mrp-sql.c 5 Apr 2004 23:59:37 -0000
@@ -458,11 +458,6 @@ get_hash_data_as_id (GHashTable *hash, g
return GPOINTER_TO_INT (value);
}
-enum {
- COL_ID,
- COL_NAME
-};
-
static gboolean
sql_read_project (SQLData *data, gint proj_id)
{
@@ -1954,6 +1949,7 @@ sql_read_tasks (SQLData *data)
gint work;
gint duration;
gint percent_complete;
+ gint priority;
gboolean is_fixed_work;
gboolean is_milestone;
MrpTaskType type;
@@ -2000,6 +1996,7 @@ sql_read_tasks (SQLData *data)
work = 0;
duration = 0;
percent_complete = 0;
+ priority = 0;
is_fixed_work = FALSE;
is_milestone = FALSE;
constraint_time = 0;
@@ -2024,6 +2021,9 @@ sql_read_tasks (SQLData *data)
else if (is_field (res, j, "percent_complete")) {
percent_complete = get_int (res, i, j);
}
+ else if (is_field (res, j, "priority")) {
+ priority = get_int (res, i, j);
+ }
else if (is_field (res, j, "is_milestone")) {
is_milestone = get_boolean (res, i, j);
}
@@ -2063,6 +2063,7 @@ sql_read_tasks (SQLData *data)
"note", note,
"type", type,
"percent_complete", percent_complete,
+ "priority", priority,
"sched", sched,
"work", work,
"duration", duration,
@@ -3367,6 +3368,7 @@ sql_write_tasks (SQLData *data)
mrptime start, finish;
gint work, duration;
gint percent_complete;
+ gint priority;
const gchar *is_fixed_work;
const gchar *is_milestone;
MrpConstraint *constraint;
@@ -3399,6 +3401,7 @@ sql_write_tasks (SQLData *data)
"note", ¬e,
"work", &work,
"percent_complete", &percent_complete,
+ "priority", &priority,
"duration", &duration,
"start", &start,
"finish", &finish,
@@ -3465,15 +3468,15 @@ sql_write_tasks (SQLData *data)
query = g_strdup_printf ("INSERT INTO task(proj_id, parent_id, name, "
"note, start, finish, work, duration, "
"percent_complete, is_milestone, is_fixed_work, "
- "constraint_type, constraint_time) "
+ "constraint_type, constraint_time, priority) "
"VALUES(%d, %s, '%s', "
"'%s', '%s', '%s', %d, %d, "
"%d, %s, %s, "
- "'%s', %s)",
+ "'%s', %s, %d)",
data->project_id, parent_id_string, name,
note, start_string, finish_string, work, duration,
percent_complete, is_milestone, is_fixed_work,
- constraint_type, constraint_time);
+ constraint_type, constraint_time, priority);
res = sql_execute_query (data->con, query);
g_free (query);
Index: libplanner/mrp-task.c
===================================================================
RCS file: /cvs/gnome/planner/libplanner/mrp-task.c,v
retrieving revision 1.2
diff -u -b -B -p -r1.2 mrp-task.c
--- libplanner/mrp-task.c 17 Feb 2004 20:00:17 -0000 1.2
+++ libplanner/mrp-task.c 5 Apr 2004 23:59:39 -0000
@@ -43,7 +43,8 @@ enum {
PROP_SCHED,
PROP_CONSTRAINT,
PROP_NOTE,
- PROP_PERCENT_COMPLETE
+ PROP_PERCENT_COMPLETE,
+ PROP_PRIORITY
};
/* Signals */
@@ -79,6 +80,9 @@ struct _MrpTaskPriv {
/* Percent complete, 0-100. */
gshort percent_complete;
+ /* Arbitary range of 0,1..9999. A hint for any (3rd party) resource leveller */
+ gint priority;
+
gchar *name;
gchar *note;
@@ -378,6 +382,15 @@ task_class_init (MrpTaskClass *klass)
"Percent completed of task",
0, 100, 0,
G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_PRIORITY,
+ g_param_spec_int ("priority",
+ "Priority",
+ "Priority of the task",
+ 0, 9999, 0,
+ G_PARAM_READWRITE));
}
static void
@@ -541,6 +554,16 @@ task_set_property (GObject *object,
break;
+ case PROP_PRIORITY:
+ i_val = g_value_get_int (value);
+
+ if (priv->priority != i_val) {
+ priv->priority = i_val;
+ changed = TRUE;
+ }
+
+ break;
+
default:
break;
}
@@ -601,6 +624,9 @@ task_get_property (GObject *object,
break;
case PROP_PERCENT_COMPLETE:
g_value_set_int (value, priv->percent_complete);
+ break;
+ case PROP_PRIORITY:
+ g_value_set_int (value, priv->priority);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
Index: src/planner-task-dialog.c
===================================================================
RCS file: /cvs/gnome/planner/src/planner-task-dialog.c,v
retrieving revision 1.4
diff -u -b -B -p -r1.4 planner-task-dialog.c
--- src/planner-task-dialog.c 27 Mar 2004 08:18:23 -0000 1.4
+++ src/planner-task-dialog.c 5 Apr 2004 23:59:41 -0000
@@ -90,6 +90,11 @@ static void task_dialog_task_complete_c
GtkWidget *dialog);
static void task_dialog_complete_changed_cb (GtkWidget *w,
DialogData *data);
+static void task_dialog_task_priority_changed_cb (MrpTask *task,
+ GParamSpec *pspec,
+ GtkWidget *dialog);
+static void task_dialog_priority_changed_cb (GtkWidget *w,
+ DialogData *data);
static void task_dialog_task_note_changed_cb (MrpTask *task,
GParamSpec *pspec,
GtkWidget *dialog);
@@ -616,6 +621,52 @@ task_dialog_complete_changed_cb (GtkWidg
}
static void
+task_dialog_task_priority_changed_cb (MrpTask *task,
+ GParamSpec *pspec,
+ GtkWidget *dialog)
+{
+ DialogData *data;
+ gint priority;
+
+ g_return_if_fail (MRP_IS_TASK (task));
+ g_return_if_fail (GTK_IS_WIDGET (dialog));
+
+ data = DIALOG_GET_DATA (dialog);
+
+ g_object_get (task, "priority", &priority, NULL);
+
+ g_signal_handlers_block_by_func (data->priority_spinbutton,
+ task_dialog_priority_changed_cb,
+ data);
+
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (data->priority_spinbutton),
+ priority);
+
+ g_signal_handlers_unblock_by_func (data->priority_spinbutton,
+ task_dialog_priority_changed_cb,
+ data);
+}
+
+static void
+task_dialog_priority_changed_cb (GtkWidget *w,
+ DialogData *data)
+{
+ gint priority;
+
+ priority = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (w));
+
+ g_signal_handlers_block_by_func (data->task,
+ task_dialog_task_priority_changed_cb,
+ data->dialog);
+
+ g_object_set (data->task, "priority", priority, NULL);
+
+ g_signal_handlers_unblock_by_func (data->task,
+ task_dialog_task_priority_changed_cb,
+ data->dialog);
+}
+
+static void
task_dialog_task_note_changed_cb (MrpTask *task,
GParamSpec *pspec,
GtkWidget *dialog)
@@ -1217,6 +1268,12 @@ task_dialog_setup_widgets (DialogData *d
data);
data->priority_spinbutton = glade_xml_get_widget (glade, "priority_spinbutton");
+ g_object_get (data->task, "priority", &int_value, NULL);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (data->priority_spinbutton), int_value);
+ g_signal_connect (data->priority_spinbutton,
+ "value_changed",
+ G_CALLBACK (task_dialog_priority_changed_cb),
+ data);
data->note_textview = glade_xml_get_widget (glade, "note_textview");
@@ -1521,6 +1578,12 @@ task_dialog_connect_to_task (DialogData
data->dialog,
0);
+ g_signal_connect_object (data->task,
+ "notify::priority",
+ G_CALLBACK (task_dialog_task_priority_changed_cb),
+ data->dialog,
+ 0);
+
g_signal_connect_object (data->task,
"child_added",
G_CALLBACK (task_dialog_task_child_added_or_removed_cb),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]