Fix for bug 99519: timestamps were not being set correctly in the activity table…

Fix for bug 99519: timestamps were not being set correctly in the activity table in some situations, and the delta_ts on the bug itself was not always being updated if dependencies or CCs changed. Patch by Dave Miller <justdave@syndicomm.com> r= bbaetz, jake
parent 8e63a96f
...@@ -863,6 +863,7 @@ sub SnapShotDeps { ...@@ -863,6 +863,7 @@ sub SnapShotDeps {
my $timestamp; my $timestamp;
my $bug_changed;
sub FindWrapPoint { sub FindWrapPoint {
my ($string, $startpos) = @_; my ($string, $startpos) = @_;
...@@ -912,7 +913,8 @@ sub LogActivityEntry { ...@@ -912,7 +913,8 @@ sub LogActivityEntry {
my $fieldid = GetFieldID($col); my $fieldid = GetFieldID($col);
SendSQL("INSERT INTO bugs_activity " . SendSQL("INSERT INTO bugs_activity " .
"(bug_id,who,bug_when,fieldid,removed,added) VALUES " . "(bug_id,who,bug_when,fieldid,removed,added) VALUES " .
"($i,$whoid,$timestamp,$fieldid,$removestr,$addstr)"); "($i,$whoid," . SqlQuote($timestamp) . ",$fieldid,$removestr,$addstr)");
$bug_changed = 1;
} }
} }
...@@ -934,6 +936,7 @@ sub LogDependencyActivity { ...@@ -934,6 +936,7 @@ sub LogDependencyActivity {
# #
foreach my $id (@idlist) { foreach my $id (@idlist) {
my %dependencychanged; my %dependencychanged;
$bug_changed = 0;
my $write = "WRITE"; # Might want to make a param to control my $write = "WRITE"; # Might want to make a param to control
# whether we do LOW_PRIORITY ... # whether we do LOW_PRIORITY ...
SendSQL("LOCK TABLES bugs $write, bugs_activity $write, cc $write, " . SendSQL("LOCK TABLES bugs $write, bugs_activity $write, cc $write, " .
...@@ -1116,17 +1119,14 @@ The changes made were: ...@@ -1116,17 +1119,14 @@ The changes made were:
" WHERE bug_id = $id"); " WHERE bug_id = $id");
} }
} }
my $query = "$basequery\nwhere bug_id = $id"; my $query = "$basequery\nwhere bug_id = $id";
# print "<PRE>$query</PRE>\n"; # print "<PRE>$query</PRE>\n";
if ($::comma ne "") { if ($::comma ne "") {
SendSQL($query); SendSQL($query);
SendSQL("select delta_ts from bugs where bug_id = $id");
} else {
SendSQL("select now()");
} }
SendSQL("select now()");
$timestamp = FetchOneColumn(); $timestamp = FetchOneColumn();
if (defined $::FORM{'comment'}) { if (defined $::FORM{'comment'}) {
...@@ -1339,7 +1339,9 @@ The changes made were: ...@@ -1339,7 +1339,9 @@ The changes made were:
LogActivityEntry($id,$col,$old,$new); LogActivityEntry($id,$col,$old,$new);
} }
} }
if ($bug_changed) {
SendSQL("UPDATE bugs SET delta_ts = " . SqlQuote($timestamp) . " WHERE bug_id = $id");
}
print "<TABLE BORDER=1><TD><H2>Changes to bug $id submitted</H2>\n"; print "<TABLE BORDER=1><TD><H2>Changes to bug $id submitted</H2>\n";
SendSQL("unlock tables"); SendSQL("unlock tables");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment