fixed: plugin 'group'

Groups::ReindexGroups incorrectly read a field from a PT::Space (it used 'table' object directly)
       but the value was in 'table_single' 
       now we are using GetValue method



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@916 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2013-02-01 21:14:56 +00:00
parent 60f2337b73
commit 293e426ed4
1 changed files with 11 additions and 7 deletions

View File

@ -2,7 +2,7 @@
* This file is a part of Winix * This file is a part of Winix
* and is not publicly distributed * and is not publicly distributed
* *
* Copyright (c) 2011-2012, Tomasz Sowa * Copyright (c) 2011-2013, Tomasz Sowa
* All rights reserved. * All rights reserved.
* *
*/ */
@ -63,27 +63,31 @@ size_t i, v;
// loop through all values in the group // loop through all values in the group
for(v=0 ; v<group.spaces.size() ; ) for(v=0 ; v<group.spaces.size() ; )
{ {
PT::Space::Table::iterator vali = group.spaces[v]->table.find(key); std::wstring * vali = group.spaces[v]->GetValue(key);
if( vali != group.spaces[v]->table.end() && vali->second.size() == 1 ) if( vali )
{ {
GroupIndex::iterator g = group_index.find(vali->second[0]); GroupIndex::iterator g = group_index.find(*vali);
if( g == group_index.end() ) if( g == group_index.end() )
{ {
group_index[vali->second[0]] = i; group_index[*vali] = i;
v += 1; v += 1;
} }
else else
{ {
slog << logwarning << "set: " << set.name << " has a group with a duplicated value: " slog << logwarning << "set: " << set.name << " has a group with a duplicated value: "
<< vali->second[0] << " (skipping)" << logend; << *vali << " (skipping)" << logend;
group.spaces.erase(group.spaces.begin() + v); group.spaces.erase(group.spaces.begin() + v);
} }
} }
else else
{ {
slog << logwarning << "set: " << set.name << " has a group without a value (skipping)" << logend; log << log1 << "key: " << key << " was not found" << logend;
slog << logwarning << "set: " << set.name
<< " has a group without a value (skipping)" << logend;
group.spaces.erase(group.spaces.begin() + v); group.spaces.erase(group.spaces.begin() + v);
} }
} }