New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

most recent notes issue #677

Closed
vomikan opened this Issue Jan 29, 2016 · 7 comments

Comments

Projects
None yet
3 participants
@vomikan
Contributor

vomikan commented Jan 29, 2016

it is not the twenty most recent notes, or even the twenty most common notes. On my PC, I have notes that in that field that have only been used once, but the supermarket that I go to every week does not appear and has to be typed out by hand every time. If I understand the notes correctly, they are supposed to be the most commonly used entries. That is certainly not the case with me.

http://forum.moneymanagerex.org/viewtopic.php?f=10&t=6247

@vomikan vomikan added the bug label Jan 30, 2016

@vomikan vomikan added this to the v1.3 milestone Jan 30, 2016

vomikan added a commit that referenced this issue Jan 31, 2016

@vomikan vomikan modified the milestones: v1.4, v1.3 Jan 31, 2016

stef145g added a commit that referenced this issue Feb 2, 2016

Merge pull request #685 from vomikan/#677
 fix(#677): most recent notes issue

vomikan added a commit that referenced this issue Feb 2, 2016

Merge pull request #688 from vomikan/#677
fix(#677): revert incorrect value
@guanlisheng

This comment has been minimized.

Contributor

guanlisheng commented Feb 14, 2016

has this been fixed? @vomikan

@vomikan

This comment has been minimized.

Contributor

vomikan commented Feb 14, 2016

may be only performance issue.

@vomikan vomikan closed this Feb 14, 2016

@guanlisheng

This comment has been minimized.

Contributor

guanlisheng commented Feb 14, 2016

what is the performance issue, is there any data to reproduce the issue?

@guanlisheng guanlisheng reopened this Feb 14, 2016

@vomikan

This comment has been minimized.

Contributor

vomikan commented Feb 14, 2016

Just needed any account with about 10k transactions with notes.

@guanlisheng

This comment has been minimized.

Contributor

guanlisheng commented Feb 19, 2016

ok. let's use priority queue to process counterMap
http://www.cplusplus.com/reference/queue/priority_queue/

@guanlisheng

This comment has been minimized.

Contributor

guanlisheng commented Feb 19, 2016

@vomikan here you go

const auto notes = instance().find(NOTES("", NOT_EQUAL)
    , accountID > 0 ? ACCOUNTID(accountID) : ACCOUNTID(-1, NOT_EQUAL));

std::map <wxString, size_t> counterMap;
for (const auto& entry : notes)
    counterMap[entry.NOTES]++;

std::priority_queue<std::pair<size_t, wxString> > q;
for (const auto & kv: counterMap)
{   
    q.push(std::make_pair(kv.second, kv.first));
}   

while(!q.empty() && frequentNotes.size() < 20) 
{   
    const auto & kv = q.top();
    frequentNotes.push_back(kv.second);
    q.pop();
}   
@vomikan

This comment has been minimized.

Contributor

vomikan commented Feb 22, 2016

Here is Trim() needed

for (const auto& entry : notes)
    counterMap[wxString(entry.NOTES).Trim()]++;

vomikan added a commit that referenced this issue Feb 22, 2016

@vomikan vomikan closed this Feb 26, 2016

@slodki slodki added the fixed label Jul 25, 2017

@slodki slodki modified the milestones: v1.2, v2.0 Jul 25, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment