Skip to content

Fred working branch #27

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fixes number counting problems in #5.
  • Loading branch information
fkirwin committed Aug 7, 2017
commit 8268ef90d6295b2d257e8b4b21f5bfd6fde90f34
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public class FlashCardController {
public void setFlashCardService(FlashCardService flashCardService) {
this.flashCardService = flashCardService;
}

@SuppressWarnings("unchecked")
private Map<Long, Long> getCardCounts(HttpServletRequest req) {
Map<Long, Long> cardCounts = (Map<Long, Long>) req.getSession().getAttribute("cardCounts");
Map<Long, Long> cardCounts = (Map<Long, Long>) req.getSession().getAttribute("cardCounts");
if (cardCounts == null) {
cardCounts = new HashMap<>();
req.getSession().setAttribute("cardCounts", cardCounts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ public FlashCard getNextFlashCardBasedOnViews(Map<Long, Long> idToViewCounts) {
continue;
}
Long lowestScore = idToViewCounts.get(leastViewedId);
if (entry.getValue() >= lowestScore) {
break;
if (entry.getValue() < lowestScore) {
leastViewedId = entry.getKey();
}
leastViewedId = entry.getKey();

}
return flashCardRepository.findOne(leastViewedId);
}
Expand Down