schedule and schedule_change tables not written to
|Reported by:||jc||Owned by:||Chris Nelson|
(background to this ticket: https://trac-hacks.org/ticket/11761)
tracpm.py: rescheduleTickets: contains line like:
2913 values.append(to_utimestamp(self.pm.finish(t))) 2914 cursor.execute('INSERT INTO schedule' + \ 2915 ' (ticket, start, finish)' + \ 2916 ' VALUES %s' % valuesClause, 2917 values)
These inserts are queued but rolled back instead of being commited.
The following patch ensures the inserts are carried out, but may have side effects: def rescheduleTickets(self, ticket, old_values) (at the very bottom):
profile.append([ 'inserting', len(toInsert), end - start ]) + db.commit() for step in profile: self.env.log.info('TracPM:%s %s tickets took %s' % (step, step, step))
This following guidance in http://trac.edgewall.org/wiki/TracDev/DatabaseApi, a db.commit() has to be explicitly added with cnx connections. They also state: The use of env.get_db_cnx() is now strongly discouraged. etc.
Side-effects: In fact, by forcing a commit, existing diagrams are drawn in completely new ways, with tasks previously "anchored" say in April, now appearing at the end of July.
This effect is documented in https://trac-hacks.org/attachment/ticket/11761/CommitEnabled1.pdf
This may be a reason why these tables were not written to(?)