Commit 760e2369 by Maarten L. Hekkelman

remove suprious error messages,

fix getUniqueID to use correct key field
parent cfba00ae
...@@ -1389,13 +1389,17 @@ std::string Category::getUniqueID(std::function<std::string(int)> generator) ...@@ -1389,13 +1389,17 @@ std::string Category::getUniqueID(std::function<std::string(int)> generator)
{ {
using namespace cif::literals; using namespace cif::literals;
std::string key = "id";
if (mCatValidator != nullptr and mCatValidator->mKeys.size() == 1)
key = mCatValidator->mKeys.front();
int nr = size() + 1; int nr = size() + 1;
for (;;) for (;;)
{ {
std::string result = generator(nr++); std::string result = generator(nr++);
if (exists("id"_key == result)) if (exists(Key(key) == result))
continue; continue;
return result; return result;
...@@ -2579,8 +2583,11 @@ void Category::update_value(RowSet &&rows, const std::string &tag, const std::st ...@@ -2579,8 +2583,11 @@ void Category::update_value(RowSet &&rows, const std::string &tag, const std::st
if (childCat->mCatValidator != nullptr and childCat->mCatValidator->mKeys.size() == 1) if (childCat->mCatValidator != nullptr and childCat->mCatValidator->mKeys.size() == 1)
{ {
auto copy = childCat->copyRow(child); auto copy = childCat->copyRow(child);
if (copy != child) if (copy != child)
{
process.push_back(child); process.push_back(child);
continue;
}
} }
// cannot update this... // cannot update this...
......
...@@ -721,13 +721,13 @@ void CompoundFactory::popDictionary() ...@@ -721,13 +721,13 @@ void CompoundFactory::popDictionary()
const Compound *CompoundFactory::create(std::string id) const Compound *CompoundFactory::create(std::string id)
{ {
static bool warned = false; // static bool warned = false;
if (mImpl and warned == false) // if (mImpl and warned == false)
{ // {
std::cerr << "Warning: no compound information library was found, resulting data may be incorrect or incomplete" << std::endl; // std::cerr << "Warning: no compound information library was found, resulting data may be incorrect or incomplete" << std::endl;
warned = true; // warned = true;
} // }
return mImpl ? mImpl->get(id) : nullptr; return mImpl ? mImpl->get(id) : nullptr;
} }
......
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