Permalink
Browse files

Messy merge, hopefully I pieced everything back together correctly.

  • Loading branch information...
Andy Kramolisch
Andy Kramolisch committed Apr 17, 2012
2 parents 066dff9 + 0fb989d commit 32bb39585287076b8fc30f5abd9ec5b25b2acd74
Showing with 7,508 additions and 384 deletions.
  1. +15 −0 ActivEarth.Objects/Competition/ActivityScore.cs
  2. +133 −51 ActivEarth.Objects/Competition/Badges/Badge.cs
  3. +66 −58 ActivEarth.Objects/Competition/Badges/BadgeConstants.cs
  4. +40 −11 ActivEarth.Objects/Competition/Challenges/Challenge.cs
  5. +49 −15 ActivEarth.Objects/Competition/Contests/Contest.cs
  6. +18 −11 ActivEarth.Objects/Groups/Group.cs
  7. +18 −6 ActivEarth.Objects/Profile/Statistic.cs
  8. +1 −1 ActivEarth.Objects/Profile/User.cs
  9. +8 −2 ActivEarth.Server.Service/ActivEarth.Server.Data.csproj
  10. +97 −3 ActivEarth.Server.Service/ActivEarthDataProviders.dbml
  11. +136 −25 ActivEarth.Server.Service/ActivEarthDataProviders.dbml.layout
  12. +2,078 −9 ActivEarth.Server.Service/ActivEarthDataProviders.designer.cs
  13. +35 −0 ActivEarth.Server.Service/BadgeManager.cs
  14. +76 −6 ActivEarth.Server.Service/ContestManager.cs
  15. +184 −0 ActivEarth.Server.Service/DAO/BadgeDAO.cs
  16. +99 −0 ActivEarth.Server.Service/DAO/BadgeLevelInfoDAO.cs
  17. +135 −9 ActivEarth.Server.Service/DAO/ChallengeDAO.cs
  18. +100 −10 ActivEarth.Server.Service/DAO/ContestDAO.cs
  19. +542 −0 ActivEarth.Server.Service/DAO/GroupDAO.cs
  20. +47 −0 ActivEarth.Server.Service/DAO/StatisticInfoDAO.cs
  21. +22 −3 ActivEarth.Server.Service/DAO/UserDAO.cs
  22. +3 −1 ActivEarth.Tests/ActivEarth.Tests.csproj
  23. +230 −0 ActivEarth.Tests/Competition/Badges/BadgeDAOTest.cs
  24. +120 −44 ActivEarth.Tests/Competition/Badges/BadgeTest.cs
  25. +79 −1 ActivEarth.Tests/Competition/Challenges/ChallengeDAOTest.cs
  26. +7 −7 ActivEarth.Tests/Competition/Challenges/ChallengeTest.cs
  27. +103 −24 ActivEarth.Tests/Competition/Contests/ContestDAOTest.cs
  28. +8 −8 ActivEarth.Tests/Competition/Contests/ContestTest.cs
  29. +338 −0 ActivEarth.Tests/Groups/GroupDAOTest.cs
  30. +1 −1 ActivEarth/About.aspx
  31. +1 −1 ActivEarth/Account/Login.aspx
  32. +1 −1 ActivEarth/Account/Login.aspx.cs
  33. +1 −1 ActivEarth/Account/Profile.aspx
  34. +1 −1 ActivEarth/Account/Register.aspx
  35. +245 −0 ActivEarth/ActivEarth.csproj
  36. +43 −0 ActivEarth/Competition/Badges/DisplayBadgeControl.ascx
  37. +32 −0 ActivEarth/Competition/Badges/DisplayBadgeControl.ascx.cs
  38. +78 −0 ActivEarth/Competition/Badges/DisplayBadgeControl.ascx.designer.cs
  39. +6 −0 ActivEarth/Competition/Badges/DisplayBadgesControl.ascx
  40. +26 −0 ActivEarth/Competition/Badges/DisplayBadgesControl.ascx.cs
  41. +24 −0 ActivEarth/Competition/Badges/DisplayBadgesControl.ascx.designer.cs
  42. +12 −0 ActivEarth/Competition/Badges/DisplayBadgesPage.aspx
  43. +44 −0 ActivEarth/Competition/Badges/DisplayBadgesPage.aspx.cs
  44. +24 −0 ActivEarth/Competition/Badges/DisplayBadgesPage.aspx.designer.cs
  45. +45 −0 ActivEarth/Competition/Challenges/DisplayChallengeControl.ascx
  46. +35 −0 ActivEarth/Competition/Challenges/DisplayChallengeControl.ascx.cs
  47. +87 −0 ActivEarth/Competition/Challenges/DisplayChallengeControl.ascx.designer.cs
  48. +5 −0 ActivEarth/Competition/Challenges/DisplayChallengesControl.ascx
  49. +25 −0 ActivEarth/Competition/Challenges/DisplayChallengesControl.ascx.cs
  50. +24 −0 ActivEarth/Competition/Challenges/DisplayChallengesControl.ascx.designer.cs
  51. +25 −0 ActivEarth/Competition/Challenges/DisplayChallengesPage.aspx
  52. +79 −0 ActivEarth/Competition/Challenges/DisplayChallengesPage.aspx.cs
  53. +87 −0 ActivEarth/Competition/Challenges/DisplayChallengesPage.aspx.designer.cs
  54. +11 −0 ActivEarth/Competition/Contests/ContestDisplayTable.ascx
  55. +72 −0 ActivEarth/Competition/Contests/ContestDisplayTable.ascx.cs
  56. +24 −0 ActivEarth/Competition/Contests/ContestDisplayTable.ascx.designer.cs
  57. +6 −0 ActivEarth/Competition/Contests/ContestHomePage.aspx
  58. +18 −0 ActivEarth/Competition/Contests/ContestHomePage.aspx.cs
  59. +15 −0 ActivEarth/Competition/Contests/ContestHomePage.aspx.designer.cs
  60. +6 −0 ActivEarth/Competition/Contests/ContestList.ascx
  61. +34 −0 ActivEarth/Competition/Contests/ContestList.ascx.cs
  62. +24 −0 ActivEarth/Competition/Contests/ContestList.ascx.designer.cs
  63. +10 −0 ActivEarth/Competition/Contests/ContestListRow.ascx
  64. +34 −0 ActivEarth/Competition/Contests/ContestListRow.ascx.cs
  65. +33 −0 ActivEarth/Competition/Contests/ContestListRow.ascx.designer.cs
  66. +37 −0 ActivEarth/Competition/Contests/CountdownClock.ascx
  67. +14 −0 ActivEarth/Competition/Contests/CountdownClock.ascx.cs
  68. +69 −0 ActivEarth/Competition/Contests/CountdownClock.ascx.designer.cs
  69. +23 −0 ActivEarth/Competition/Contests/DisplayContestPage.aspx
  70. +92 −0 ActivEarth/Competition/Contests/DisplayContestPage.aspx.cs
  71. +42 −0 ActivEarth/Competition/Contests/DisplayContestPage.aspx.designer.cs
  72. +23 −0 ActivEarth/Competition/Contests/LeaderBoard.ascx
  73. +115 −0 ActivEarth/Competition/Contests/LeaderBoard.ascx.cs
  74. +60 −0 ActivEarth/Competition/Contests/LeaderBoard.ascx.designer.cs
  75. +21 −0 ActivEarth/Competition/Contests/LeaderBoardRow.ascx
  76. +43 −0 ActivEarth/Competition/Contests/LeaderBoardRow.ascx.cs
  77. +51 −0 ActivEarth/Competition/Contests/LeaderBoardRow.ascx.designer.cs
  78. +4 −2 ActivEarth/Default.aspx
  79. +1 −0 ActivEarth/Default.aspx.cs
  80. +18 −0 ActivEarth/Default.aspx.designer.cs
  81. +1 −1 ActivEarth/Fitness/BMI.aspx
  82. BIN ActivEarth/Images/Competition/Activity_Score.png
  83. BIN ActivEarth/Images/Competition/Badges/Badge_Row.png
  84. BIN ActivEarth/Images/Competition/Badges/Badge_Templates/Bronze.png
  85. BIN ActivEarth/Images/Competition/Badges/Badge_Templates/Diamond.png
  86. BIN ActivEarth/Images/Competition/Badges/Badge_Templates/Emerald.png
  87. BIN ActivEarth/Images/Competition/Badges/Badge_Templates/Gold.png
  88. BIN ActivEarth/Images/Competition/Badges/Badge_Templates/Platinum.png
  89. BIN ActivEarth/Images/Competition/Badges/Badge_Templates/Ruby.png
  90. BIN ActivEarth/Images/Competition/Badges/Badge_Templates/Sapphire.png
  91. BIN ActivEarth/Images/Competition/Badges/Badge_Templates/Silver.png
  92. BIN ActivEarth/Images/Competition/Badges/Challenges_Completed/Bronze.png
  93. BIN ActivEarth/Images/Competition/Badges/Challenges_Completed/Diamond.png
  94. BIN ActivEarth/Images/Competition/Badges/Challenges_Completed/Emerald.png
  95. BIN ActivEarth/Images/Competition/Badges/Challenges_Completed/Gold.png
  96. BIN ActivEarth/Images/Competition/Badges/Challenges_Completed/None.png
  97. BIN ActivEarth/Images/Competition/Badges/Challenges_Completed/Platinum.png
  98. BIN ActivEarth/Images/Competition/Badges/Challenges_Completed/Ruby.png
  99. BIN ActivEarth/Images/Competition/Badges/Challenges_Completed/Sapphire.png
  100. BIN ActivEarth/Images/Competition/Badges/Challenges_Completed/Silver.png
  101. BIN ActivEarth/Images/Competition/Badges/Distance_Biked/Bronze.png
  102. BIN ActivEarth/Images/Competition/Badges/Distance_Biked/Diamond.png
  103. BIN ActivEarth/Images/Competition/Badges/Distance_Biked/Emerald.png
  104. BIN ActivEarth/Images/Competition/Badges/Distance_Biked/Gold.png
  105. BIN ActivEarth/Images/Competition/Badges/Distance_Biked/None.png
  106. BIN ActivEarth/Images/Competition/Badges/Distance_Biked/Platinum.png
  107. BIN ActivEarth/Images/Competition/Badges/Distance_Biked/Ruby.png
  108. BIN ActivEarth/Images/Competition/Badges/Distance_Biked/Sapphire.png
  109. BIN ActivEarth/Images/Competition/Badges/Distance_Biked/Silver.png
  110. BIN ActivEarth/Images/Competition/Badges/Distance_Ran/Bronze.png
  111. BIN ActivEarth/Images/Competition/Badges/Distance_Ran/Diamond.png
  112. BIN ActivEarth/Images/Competition/Badges/Distance_Ran/Emerald.png
  113. BIN ActivEarth/Images/Competition/Badges/Distance_Ran/Gold.png
  114. BIN ActivEarth/Images/Competition/Badges/Distance_Ran/None.png
  115. BIN ActivEarth/Images/Competition/Badges/Distance_Ran/Platinum.png
  116. BIN ActivEarth/Images/Competition/Badges/Distance_Ran/Ruby.png
  117. BIN ActivEarth/Images/Competition/Badges/Distance_Ran/Sapphire.png
  118. BIN ActivEarth/Images/Competition/Badges/Distance_Ran/Silver.png
  119. BIN ActivEarth/Images/Competition/Badges/Distance_Walked/Bronze.png
  120. BIN ActivEarth/Images/Competition/Badges/Distance_Walked/Diamond.png
  121. BIN ActivEarth/Images/Competition/Badges/Distance_Walked/Emerald.png
  122. BIN ActivEarth/Images/Competition/Badges/Distance_Walked/Gold.png
  123. BIN ActivEarth/Images/Competition/Badges/Distance_Walked/None.png
  124. BIN ActivEarth/Images/Competition/Badges/Distance_Walked/Platinum.png
  125. BIN ActivEarth/Images/Competition/Badges/Distance_Walked/Ruby.png
  126. BIN ActivEarth/Images/Competition/Badges/Distance_Walked/Sapphire.png
  127. BIN ActivEarth/Images/Competition/Badges/Distance_Walked/Silver.png
  128. BIN ActivEarth/Images/Competition/Badges/Gas_Savings/Bronze.png
  129. BIN ActivEarth/Images/Competition/Badges/Gas_Savings/Diamond.png
  130. BIN ActivEarth/Images/Competition/Badges/Gas_Savings/Emerald.png
  131. BIN ActivEarth/Images/Competition/Badges/Gas_Savings/Gold.png
  132. BIN ActivEarth/Images/Competition/Badges/Gas_Savings/None.png
  133. BIN ActivEarth/Images/Competition/Badges/Gas_Savings/Platinum.png
  134. BIN ActivEarth/Images/Competition/Badges/Gas_Savings/Ruby.png
  135. BIN ActivEarth/Images/Competition/Badges/Gas_Savings/Sapphire.png
  136. BIN ActivEarth/Images/Competition/Badges/Gas_Savings/Silver.png
  137. BIN ActivEarth/Images/Competition/Badges/Steps/Bronze.png
  138. BIN ActivEarth/Images/Competition/Badges/Steps/Diamond.png
  139. BIN ActivEarth/Images/Competition/Badges/Steps/Emerald.png
  140. BIN ActivEarth/Images/Competition/Badges/Steps/Gold.png
  141. BIN ActivEarth/Images/Competition/Badges/Steps/None.png
  142. BIN ActivEarth/Images/Competition/Badges/Steps/Platinum.png
  143. BIN ActivEarth/Images/Competition/Badges/Steps/Ruby.png
  144. BIN ActivEarth/Images/Competition/Badges/Steps/Sapphire.png
  145. BIN ActivEarth/Images/Competition/Badges/Steps/Silver.png
  146. BIN ActivEarth/Images/Competition/Badges/Symbols/Challenges_Completed.png
  147. BIN ActivEarth/Images/Competition/Badges/Symbols/Distance_Biked.png
  148. BIN ActivEarth/Images/Competition/Badges/Symbols/Distance_Ran.png
  149. BIN ActivEarth/Images/Competition/Badges/Symbols/Distance_Walked.png
  150. BIN ActivEarth/Images/Competition/Badges/Symbols/Steps.png
  151. BIN ActivEarth/Images/Competition/Challenges/Challenge_Symbols/Distance_Biked.png
  152. BIN ActivEarth/Images/Competition/Challenges/Challenge_Symbols/Distance_Ran.png
  153. BIN ActivEarth/Images/Competition/Challenges/Challenge_Symbols/Distance_Walked.png
  154. BIN ActivEarth/Images/Competition/Challenges/Challenge_Symbols/GasSavings.png
  155. BIN ActivEarth/Images/Competition/Challenges/Challenge_Symbols/Steps.png
  156. BIN ActivEarth/Images/Competition/Challenges/Challenges_Row.png
  157. BIN ActivEarth/Images/Competition/Challenges/Challenges_Template/Daily.png
  158. BIN ActivEarth/Images/Competition/Challenges/Challenges_Template/Monthly.png
  159. BIN ActivEarth/Images/Competition/Challenges/Challenges_Template/Permanent.png
  160. BIN ActivEarth/Images/Competition/Challenges/Challenges_Template/Weekly.png
  161. BIN ActivEarth/Images/Competition/Challenges/Distance_Biked/Daily.png
  162. BIN ActivEarth/Images/Competition/Challenges/Distance_Biked/Monthly.png
  163. BIN ActivEarth/Images/Competition/Challenges/Distance_Biked/Weekly.png
  164. BIN ActivEarth/Images/Competition/Challenges/Distance_Ran/Daily.png
  165. BIN ActivEarth/Images/Competition/Challenges/Distance_Ran/Monthly.png
  166. BIN ActivEarth/Images/Competition/Challenges/Distance_Ran/Weekly.png
  167. BIN ActivEarth/Images/Competition/Challenges/Distance_Walked/Daily.png
  168. BIN ActivEarth/Images/Competition/Challenges/Distance_Walked/Monthly.png
  169. BIN ActivEarth/Images/Competition/Challenges/Distance_Walked/Weekly.png
  170. BIN ActivEarth/Images/Competition/Challenges/Gas_Savings/Daily.png
  171. BIN ActivEarth/Images/Competition/Challenges/Gas_Savings/Monthly.png
  172. BIN ActivEarth/Images/Competition/Challenges/Gas_Savings/Weekly.png
  173. BIN ActivEarth/Images/Competition/Challenges/Steps/Daily.png
  174. BIN ActivEarth/Images/Competition/Challenges/Steps/Monthly.png
  175. BIN ActivEarth/Images/Competition/Challenges/Steps/Weekly.png
  176. BIN ActivEarth/Images/Competition/Challenges/Time_Biked/Daily.png
  177. BIN ActivEarth/Images/Competition/Challenges/Time_Biked/Monthly.png
  178. BIN ActivEarth/Images/Competition/Challenges/Time_Biked/Weekly.png
  179. BIN ActivEarth/Images/Competition/Challenges/Time_Ran/Daily.png
  180. BIN ActivEarth/Images/Competition/Challenges/Time_Ran/Monthly.png
  181. BIN ActivEarth/Images/Competition/Challenges/Time_Ran/Weekly.png
  182. BIN ActivEarth/Images/Competition/Challenges/Time_Walked/Daily.png
  183. BIN ActivEarth/Images/Competition/Challenges/Time_Walked/Monthly.png
  184. BIN ActivEarth/Images/Competition/Challenges/Time_Walked/Weekly.png
  185. BIN ActivEarth/Images/Competition/Misc/LeftArrow.png
  186. BIN ActivEarth/Images/Competition/Misc/RightArrow.png
  187. BIN ActivEarth/Images/Competition/ProgressBar/ProgressBarBackground.png
  188. BIN ActivEarth/Images/Competition/ProgressBar/ProgressBarIndicator.png
  189. BIN ActivEarth/Images/Competition/ProgressBar/ProgressBarLeft.png
  190. BIN ActivEarth/Images/Competition/ProgressBar/ProgressBarRight.png
  191. +16 −10 ActivEarth/Site.Master
  192. +4 −0 ActivEarth/Site.Master.cs
  193. +11 −2 ActivEarth/Site.Master.designer.cs
  194. +38 −0 ActivEarth/SiteNotLoggedIn.Master
  195. +42 −0 ActivEarth/SiteNotLoggedIn.Master.cs
  196. +87 −0 ActivEarth/SiteNotLoggedIn.Master.designer.cs
  197. +42 −4 ActivEarth/Styles/Site.css
  198. +23 −0 ActivEarth/Tabs.master
  199. +17 −0 ActivEarth/Tabs.master.cs
  200. +42 −0 ActivEarth/Tabs.master.designer.cs
  201. +54 −46 ActivEarth/Web.config
  202. BIN ActivEarth/bin/EO.Web.dll
  203. +1 −0 ActivEarth/eo_web.ashx
  204. +230 −1 dbMaintain/Scripts/Create/TestData.sql
  205. +25 −0 dbMaintain/Scripts/Create/dbo.Badge_Level_Info.Table.sql
  206. +31 −0 dbMaintain/Scripts/Create/dbo.Badges.Table.sql
  207. +33 −0 dbMaintain/Scripts/Create/dbo.Challenge_Definitions.Table.sql
  208. +4 −1 dbMaintain/Scripts/Create/dbo.Contests.Table.sql
  209. +36 −0 dbMaintain/Scripts/Create/dbo.Group_Contests.Table.sql
  210. +35 −0 dbMaintain/Scripts/Create/dbo.Group_Hashtags.Table.sql
  211. +15 −2 dbMaintain/Scripts/Create/dbo.Groups.Table.sql
  212. +48 −0 dbMaintain/Scripts/Create/dbo.Messages.Table.sql
  213. +23 −0 dbMaintain/Scripts/Create/dbo.Statistic_Info.Table.sql
  214. +4 −4 dbMaintain/Scripts/Create/{dbo.Statistics.Table.sql → dbo.UserStatistics.Table.sql}
  215. +8 −1 dbMaintain/Scripts/Create/script_run_order.txt
@@ -56,6 +56,21 @@ public ActivityScore()
this.ContestScore = 0;
}
+ /// <summary>
+ /// Creates a new ActivityScore, initialized to the given parameters. Used to rebuild
+ /// Group and User objects when retreiving data from the DB.
+ /// </summary>
+ /// <param name="badgeScore">The BadgeScore stored in the DB</param>
+ /// <param name="challengeScore">The ChallengeScore stored in the DB</param>
+ /// <param name="contestScore">The ContestScore stored in the DB</param>
+ public ActivityScore(int badgeScore, int challengeScore, int contestScore)
+ {
+ this.BadgeScore = badgeScore;
+ this.ChallengeScore = challengeScore;
+ this.ContestScore = contestScore;
+ this.TotalScore = badgeScore + challengeScore + contestScore;
+ }
+
#endregion ---------- Constructor ----------
#region ---------- Public Methods ----------
@@ -14,11 +14,20 @@ public class Badge
public int ID
{
get;
- private set;
+ set;
+ }
+
+ /// <summary>
+ /// Indentifier for the owner of the badge.
+ /// </summary>
+ public int UserID
+ {
+ get;
+ set;
}
/// <summary>
- /// Name for the badge.
+ /// Name of the badge.
/// </summary>
public string Name
{
@@ -36,9 +45,63 @@ public int Level
}
/// <summary>
- /// Progress made toward the next level of the badge.
+ /// Progress made toward the next level of the badge as a percentage (0-100).
/// </summary>
- public float Progress
+ public int Progress
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Statistic to which the badge is bound.
+ /// </summary>
+ public Statistic StatisticBinding
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// User to which the badge is bound.
+ /// </summary>
+ public User User
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Path for the badge image.
+ /// </summary>
+ public string ImagePath
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Array of the values required to advance to each level of the badge.
+ /// </summary>
+ public float[] LevelRequirements
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Array of the activity points awarded for each level of the badge.
+ /// </summary>
+ public int[] LevelRewards
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Format string for reporting the badge information.
+ /// </summary>
+ public string FormatString
{
get;
set;
@@ -48,24 +111,43 @@ public float Progress
#region ---------- Constructor ----------
+ /// <summary>
+ /// Empty constructor for reading back in from the DB.
+ /// </summary>
+ public Badge()
+ {
+ this.Level = BadgeLevels.None;
+ this.Progress = 0;
+ }
+
+ /// <summary>
+ /// Creates a new badge belonging to a user, based on a specific statistic.
+ /// </summary>
+ /// <param name="user">User to whom the Badge is bound.</param>
+ /// <param name="statistic">Statistic to which the Badge is bound.</param>
+ public Badge(User user, Statistic statistic)
+ : this()
+ {
+ this.User = user;
+ this.UserID = user.UserID;
+ this.StatisticBinding = statistic;
+ }
+
/// <summary>
/// Creates a new badge belonging to a user, based on a specific statistic.
/// </summary>
/// <param name="user">User to whom the Badge is bound.</param>
/// <param name="statistic">Statistic to which the Badge is bound.</param>
- public Badge(int id, string name, User user, Statistic statistic,
- float[] levelValues, int[] levelPoints, Uri[] imagePaths)
+ public Badge(User user, Statistic statistic,
+ float[] levelValues, int[] levelPoints, string[] imagePaths)
{
- this.ID = id;
- this.Name = name;
this.Level = BadgeLevels.None;
this.Progress = 0;
- _user = user;
- _statisticBinding = statistic;
- _levelRequirements = levelValues;
- _levelRewards = levelPoints;
- _ImagePaths = imagePaths;
+ User = user;
+ StatisticBinding = statistic;
+ LevelRequirements = levelValues;
+ LevelRewards = levelPoints;
}
#endregion ---------- Constructor ----------
@@ -81,34 +163,34 @@ public int Update()
int pointsEarned = 0;
int oldLevel = this.Level;
-
- float stat = _user.GetStatistic(_statisticBinding);
-
int newLevel = oldLevel;
+ float stat = User.GetStatistic(StatisticBinding);
+
while ((newLevel < BadgeLevels.Max) &&
- (stat >= _levelRequirements[(int)newLevel + 1]))
+ (stat >= LevelRequirements[(int)newLevel + 1]))
{
newLevel++;
}
for (int i = oldLevel + 1; i <= newLevel; i++)
{
- pointsEarned += _levelRewards[i];
+ pointsEarned += LevelRewards[i];
}
this.Level = newLevel;
- return pointsEarned;
- }
+ if (this.Level == BadgeLevels.Max)
+ {
+ this.Progress = 100;
+ }
+ else
+ {
+ this.Progress = (int)(100 * (stat - this.LevelRequirements[newLevel]) /
+ (this.LevelRequirements[newLevel + 1] - this.LevelRequirements[newLevel]));
+ }
- /// <summary>
- /// Returns the image path for the current Badge level's icon.
- /// </summary>
- /// <returns>Image path for the current Badge level's icon.</returns>
- public Uri GetImagePath()
- {
- return _ImagePaths[this.Level];
+ return pointsEarned;
}
/// <summary>
@@ -118,7 +200,7 @@ public Uri GetImagePath()
/// <returns>Statistic requirement for the next level of the badge.</returns>
public float GetNextLevelRequirement()
{
- return _levelRequirements[this.Level + 1];
+ return LevelRequirements[this.Level + 1];
}
/// <summary>
@@ -129,38 +211,38 @@ public float GetNextLevelRequirement()
/// level of the badge.</returns>
public int GetNextLevelReward()
{
- return _levelRewards[this.Level + 1];
+ return LevelRewards[this.Level + 1];
}
- #endregion ---------- Public Methods ----------
-
- #region ---------- Private Fields ----------
-
/// <summary>
- /// Statistic to which the badge is bound.
+ /// Returns the formatted text progress report for the Badge (e.g., "34.5 / 40.0").
/// </summary>
- private Statistic _statisticBinding;
-
- /// <summary>
- /// User to which the badge is bound.
- /// </summary>
- private User _user;
+ /// <returns>Formatted text progress report for the Badge.</returns>
+ public string GetFormattedProgress()
+ {
+ string numerator = String.Format(this.FormatString, this.User.GetStatistic(this.StatisticBinding));
- /// <summary>
- /// Array of the values required to advance to each level of the badge.
- /// </summary>
- private float[] _levelRequirements;
+ if (this.Level < BadgeLevels.Max)
+ {
+ string denominator = String.Format(this.FormatString, this.GetNextLevelRequirement());
- /// <summary>
- /// Array of the activity points awarded for each level of the badge.
- /// </summary>
- private int[] _levelRewards;
+ return String.Format("{0} / {1}", numerator, denominator);
+ }
+ else
+ {
+ return numerator;
+ }
+ }
/// <summary>
- /// Array of the image locations for each level of the badge.
+ /// Whether or not the badge path has been completed.
/// </summary>
- private Uri[] _ImagePaths;
+ /// <returns>True if the badge level has been maxed, false otherwise.</returns>
+ public bool IsComplete()
+ {
+ return (this.Level == BadgeLevels.Max);
+ }
- #endregion ---------- Private Fields ----------
+ #endregion ---------- Public Methods ----------
}
}
Oops, something went wrong.

0 comments on commit 32bb395

Please sign in to comment.