Merge lp:~knitzsche/scope-aggregator/register-category-bug-1492428 into lp:scope-aggregator

Proposed by Kyle Nitzsche
Status: Merged
Merged at revision: 148
Proposed branch: lp:~knitzsche/scope-aggregator/register-category-bug-1492428
Merge into: lp:scope-aggregator
Diff against target: 26 lines (+3/-3)
2 files modified
CMakeLists.txt (+1/-1)
src/query.cpp (+2/-2)
To merge this branch: bzr merge lp:~knitzsche/scope-aggregator/register-category-bug-1492428
Reviewer Review Type Date Requested Status
Gary.Wang Approve
Penk Chen Pending
Review via email: mp+270220@code.launchpad.net

Description of the change

don't try to register a category that is already registered (one case of that found). And timestamp that category_id in that case too (as is done generally).

To post a comment you must log in.
Revision history for this message
Gary.Wang (gary-wzl77) wrote :

I can't reproduce it either.but according to registery.log in bug description, exception is caused by duplicated category.And appending current date-time string at category id is good trick.
Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2015-08-28 15:23:48 +0000
3+++ CMakeLists.txt 2015-09-04 20:16:43 +0000
4@@ -1,4 +1,4 @@
5-set(VERSION "1.5.26")
6+set(VERSION "1.5.26.1")
7
8 # Supress qDebug() output
9 ADD_DEFINITIONS( -DQT_NO_DEBUG_OUTPUT )
10
11=== modified file 'src/query.cpp'
12--- src/query.cpp 2015-08-18 18:35:08 +0000
13+++ src/query.cpp 2015-09-04 20:16:43 +0000
14@@ -1108,10 +1108,10 @@
15 if (common_templates.find(child_scopes_m[scope->local_id()]->result_category_id_to_common_template[res.category()->id()]) != common_templates.end())
16 {
17 std::string common_template_id = child_scopes_m[scope->local_id()]->result_category_id_to_common_template[res.category()->id()];
18- std::string cat_id = common_template_id + scope->local_id();
19+ std::string cat_id = common_template_id + ":" + scope->local_id() + ":" + QDateTime::currentDateTime().toString(dateformat).toStdString();
20
21 // if the common category has not yet been registered, register it
22- if (registered_common_categories.find(cat_id) == registered_common_categories.end())
23+ if (!upstream_reply->lookup_category(cat_id))
24 {
25 std::string template_to_use = common_templates[child_scopes_m[scope->local_id()]->result_category_id_to_common_template[res.category()->id()]];
26 if (scope->category_link_to_child())

Subscribers

People subscribed via source and target branches