Skip to content
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

Up 4621 Add Date When Portlet Rating Was Made #1065

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
03a2d59
Added getting and setting the date the rating was made per
phillips1021 Dec 6, 2017
19509d1
Added getting and setting the date the rating was made in the
phillips1021 Dec 6, 2017
24d2f54
added method definitions for finding portlet ratings done within the
phillips1021 Dec 6, 2017
b0d5f28
implement methods for finding portlet ratings done within the
phillips1021 Dec 6, 2017
185eeda
added unit tests for finding portlet ratings done within the
phillips1021 Dec 6, 2017
abb4656
added two new end points for getting ratings that were done within
phillips1021 Dec 6, 2017
b0756f5
added unit tests for two new end points for getting ratings that were…
phillips1021 Dec 6, 2017
9f91d4a
added additional fields so that we can more information related to a
phillips1021 Dec 6, 2017
44bd696
reformatted per Google Java Formatter
phillips1021 Dec 6, 2017
994261e
reformatted per Google Java Formatter
phillips1021 Dec 6, 2017
6b1df42
reformatted per Google Java Formatter
phillips1021 Dec 6, 2017
99396e2
reformatted per Google Java Formatter
phillips1021 Dec 6, 2017
21d30eb
reformatted per Google Java Formatter
phillips1021 Dec 6, 2017
2587721
reformatted per Google Java Formatter
phillips1021 Dec 6, 2017
3ec0bb9
changed to use LocalDateTime instead for calculating Today minus
phillips1021 Dec 6, 2017
d6764ce
use a final field and make it clearer how the test code is setting
phillips1021 Dec 6, 2017
6545dad
removed println statement that is not needed
phillips1021 Dec 7, 2017
136a235
changed to use final integer constant for setting rating date in
phillips1021 Dec 11, 2017
19d516b
changed to use Java 8 LocalDateTime for calculating date minus
phillips1021 Dec 11, 2017
a094ddb
style(java): apply Google Java code style
ChristianMurphy Dec 11, 2017
cdecd30
Merge branch 'master' of https://github.com/Jasig/uPortal into UP-4621
ChristianMurphy Dec 11, 2017
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
Next Next commit
added two new end points for getting ratings that were done within
a certain number of days - for example all ratings done within last
30 days or all ratings for a specific portlet within last 30 days
see: https://issues.jasig.org/browse/UP-4636
  • Loading branch information
phillips1021 committed Dec 6, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit abb4656ddefdeb0ac999c76ab0e016e8d4bbac18
Original file line number Diff line number Diff line change
@@ -165,4 +165,62 @@ public ModelAndView saveUserRating(
return new ModelAndView(
"json", "rating", new MarketplaceEntryRating(Integer.parseInt(rating), review));
}

/**
* Get all ratings done on portlets since daysBack ago.
* @param request
* @param daysBack - number of days back to search for portlet ratings
* @return
*/
@RequestMapping(value="/marketplace/{daysBack}/getRatings", method = RequestMethod.GET)
public ModelAndView getPortletRatings(HttpServletRequest request, @PathVariable int daysBack) {

Set<IMarketplaceRating> portlets = marketplaceRatingDAO.getAllRatingsInLastXDays(daysBack) ;

List<MarketplaceEntryRating> ratings = new ArrayList<>();

for (IMarketplaceRating portlet : portlets) {

MarketplaceEntryRating portletRating = new MarketplaceEntryRating(
portlet.getMarketplaceRatingPK().getUserName(), portlet.getMarketplaceRatingPK().getPortletDefinition().getName(),
portlet.getMarketplaceRatingPK().getPortletDefinition().getFName(),
portlet.getRating(), portlet.getReview(), portlet.getRatingDate());

ratings.add( portletRating ) ;

}

return new ModelAndView("json", "ratings", ratings);

}

/**
* Get all ratings done on a specific portlet since daysBack ago.
* @param request
* @param fname - portlet fname
* @param daysBack - number of days back to search for portlet ratings
* @return
*/
@RequestMapping(value="/marketplace/{fname}/{daysBack}/getRatings", method = RequestMethod.GET)
public ModelAndView getPortletRatings(HttpServletRequest request, @PathVariable String fname, @PathVariable int daysBack) {

Set<IMarketplaceRating> portlets = marketplaceRatingDAO.getAllRatingsForPortletInLastXDays(daysBack, fname) ;

List<MarketplaceEntryRating> ratings = new ArrayList<>();

for (IMarketplaceRating portlet : portlets) {

MarketplaceEntryRating portletRating = new MarketplaceEntryRating(
portlet.getMarketplaceRatingPK().getUserName(), portlet.getMarketplaceRatingPK().getPortletDefinition().getName(),
portlet.getMarketplaceRatingPK().getPortletDefinition().getFName(),
portlet.getRating(), portlet.getReview(), portlet.getRatingDate());

ratings.add( portletRating ) ;

}

return new ModelAndView("json", "ratings", ratings);

}

}