C# 클래스 ActivEarth.Server.Service.Competition.ChallengeManager

Serves as a wrapper class for the ChallengeDAO class, further abstracting actions.
파일 보기 프로젝트 열기: mlcamilli/ActivEarth 1 사용 예제들

공개 메소드들

메소드 설명
CleanUp ( ) : void

Cleans up the challenge list, moving expired transient challenges to the archive and refreshing persistent challenges. Should be called daily at the challenge cutoff time.

CreateChallenge ( string name, string description, int points, bool persistent, System.DateTime start, int durationInDays, Statistic statistic, float requirement ) : int

Creates a new Challenge and adds it to the collection.

GenerateNewChallenges ( ) : void

Creates new challenges such that the correct number of each type of challenge (daily, weekly, monthly) are active.

GetChallenge ( int id, int userId ) : Challenge

Retrieves an active challenge based on its ID.

GetFormattedProgress ( int challengeId, int userId ) : string

Returns the formatted text progress report for the Challenge (e.g., "34.5 / 40.0").

GetProgress ( int challengeId, int userId ) : int

Gets the progress made by a user in the challenge as a percentage (0-100).

InitializeUser ( int challengeId, int userId ) : void

Sets a user's initial value for a challenge (to allow calculation of the user's delta from the beginning of the challenge).

IsComplete ( int challengeId, int userId ) : bool

Returns true if the user has met the requirements to complete the challenge, false otherwise.

비공개 메소드들

메소드 설명
ChallengeManager ( ) : System

Private constructor, can't instantiate class.

메소드 상세

CleanUp() 공개 정적인 메소드

Cleans up the challenge list, moving expired transient challenges to the archive and refreshing persistent challenges. Should be called daily at the challenge cutoff time.
public static CleanUp ( ) : void
리턴 void

CreateChallenge() 공개 정적인 메소드

Creates a new Challenge and adds it to the collection.
public static CreateChallenge ( string name, string description, int points, bool persistent, System.DateTime start, int durationInDays, Statistic statistic, float requirement ) : int
name string Challenge Name.
description string Challenge Description.
points int Points to be awarded upon completion of the Challenge.
persistent bool True if the Challenge is persistent, false otherwise.
start System.DateTime Time at which the challenge should begin.
durationInDays int Number of days that the challenge should be active.
statistic Statistic Statistic on which the Challenge is based.
requirement float Statistic value required to complete the challenge.
리턴 int

GenerateNewChallenges() 공개 정적인 메소드

Creates new challenges such that the correct number of each type of challenge (daily, weekly, monthly) are active.
public static GenerateNewChallenges ( ) : void
리턴 void

GetChallenge() 공개 정적인 메소드

Retrieves an active challenge based on its ID.
public static GetChallenge ( int id, int userId ) : Challenge
id int ID of the Challenge to be retrieved.
userId int Optional. UserID to load progress from.
리턴 ActivEarth.Objects.Competition.Challenges.Challenge

GetFormattedProgress() 공개 정적인 메소드

Returns the formatted text progress report for the Challenge (e.g., "34.5 / 40.0").
public static GetFormattedProgress ( int challengeId, int userId ) : string
challengeId int Challenge to report progress for.
userId int User to evaluate.
리턴 string

GetProgress() 공개 정적인 메소드

Gets the progress made by a user in the challenge as a percentage (0-100).
public static GetProgress ( int challengeId, int userId ) : int
challengeId int The challenge to evaluate progress for.
userId int The user to evaluate.
리턴 int

InitializeUser() 공개 정적인 메소드

Sets a user's initial value for a challenge (to allow calculation of the user's delta from the beginning of the challenge).
public static InitializeUser ( int challengeId, int userId ) : void
challengeId int
userId int
리턴 void

IsComplete() 공개 정적인 메소드

Returns true if the user has met the requirements to complete the challenge, false otherwise.
public static IsComplete ( int challengeId, int userId ) : bool
challengeId int Challenge to test for completion.
userId int User to evaluate.
리턴 bool