Merge pull request #911 from csoler/v0.6-GxsTransport

changed sorting of popular forums w.r.t. time of last post rather tha…
This commit is contained in:
csoler 2017-06-29 22:13:04 +02:00 committed by GitHub
commit 27774baf5d

View File

@ -815,8 +815,8 @@ void GxsGroupFrameDialog::insertGroupsData(const std::list<RsGroupMetaData> &gro
} }
else else
{ {
/* rate the others by popularity */ //popMap.insert(std::make_pair(it->mPop, groupItemInfo)); /* rate the others by popularity */
popMap.insert(std::make_pair(it->mPop, groupItemInfo)); popMap.insert(std::make_pair(it->mLastPost, groupItemInfo)); /* rate the others by time of last post */
} }
} }
@ -830,17 +830,17 @@ void GxsGroupFrameDialog::insertGroupsData(const std::list<RsGroupMetaData> &gro
uint32_t i = 0; uint32_t i = 0;
uint32_t popLimit = 0; uint32_t popLimit = 0;
std::multimap<uint32_t, GroupItemInfo>::reverse_iterator rit; std::multimap<uint32_t, GroupItemInfo>::reverse_iterator rit;
for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); ++rit, ++i) ; //for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); ++rit, ++i) ;
if (rit != popMap.rend()) { //if (rit != popMap.rend()) {
popLimit = rit->first; // popLimit = rit->first;
} //}
for (rit = popMap.rbegin(); rit != popMap.rend(); ++rit) { for (rit = popMap.rbegin(); rit != popMap.rend(); ++rit,++i) {
if (rit->second.popularity < (int) popLimit) { //if (rit->second.popularity > (int) popLimit) {
otherList.append(rit->second); if(i < popCount)
} else {
popList.append(rit->second); popList.append(rit->second);
} else
otherList.append(rit->second);
} }
/* now we can add them in as a tree! */ /* now we can add them in as a tree! */