Class UserStatistics
java.lang.Object
application.user.UserStatistics
Provides statistical information about a user's donation activity.
Acts as a service layer between the application and
DonationDao,
showing relevant userstatistics to the user.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetTotalDonationsMade(User user) Returns the total number of donations made by the user.userDonations(User user) Returns a formatted list of all donations made by the user.userFavoriteOrganization(User user) Returns the top three organizations that the user has donated to most frequently.userTotalDonationAmount(User user) Returns the total amount donated by the user across all donations.
-
Constructor Details
-
UserStatistics
public UserStatistics()Constructs a newUserStatisticsinstance with a defaultDonationDao.
-
-
Method Details
-
userFavoriteOrganization
Returns the top three organizations that the user has donated to most frequently.- Parameters:
user- the user whose favorite organizations are going to be returned.- Returns:
- a list of up to three formatted strings, each representing an organization and its donation count. Returns empty list if the user has no donations.
-
userDonations
Returns a formatted list of all donations made by the user. Each entry contains the donation amount, date, and organization.- Parameters:
user- the user whose donation history is returned.- Returns:
- a list of formatted donation strings. Returns empty list if the user has no donations
-
userTotalDonationAmount
-
getTotalDonationsMade
-