Class UserStatistics

java.lang.Object
application.user.UserStatistics

public class UserStatistics extends Object
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 Details

    • UserStatistics

      public UserStatistics()
      Constructs a new UserStatistics instance with a default DonationDao.
  • Method Details

    • userFavoriteOrganization

      public List<String> userFavoriteOrganization(User user)
      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

      public List<String> userDonations(User user)
      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

      public String userTotalDonationAmount(User user)
      Returns the total amount donated by the user across all donations.
      Parameters:
      user - the user whose total donation amount is returned.
      Returns:
      a string representation of the total donated amount. Returns "0" if no donations exist
    • getTotalDonationsMade

      public String getTotalDonationsMade(User user)
      Returns the total number of donations made by the user.
      Parameters:
      user - the user whose donation count is returned.
      Returns:
      a string representation of the total number of donations. Returns "0" if none exist.