-
Notifications
You must be signed in to change notification settings - Fork 0
Creating Competition
this is a checklist of the steps that need to be performed when creating a new competition.
Invoke the command line tool TH_UTIL.exe build-competition with the options that you need. A typical invocation is shown below:
TH_UTIL.exe build-competition --db DEV --provider-name Dummy --start-date 01-23-2014 --number-of-weeks 4
--number-of-months 1 --prize-currency S$ --weekly-prizes 500 300 300 100 100
--monthly-prizes 2500 1500 1000 --country-codes SG TH
Note that the date must be entered in the format mm/dd/yyyy.
This will create the elements needed to run the competition in the database. Use TH_UTIL.exe build-competition to see the help menu and find more details about the various options.
The command line tool should have inserted the following elements in the database:
- 1 row in
Provider - 1 row in
Competition+ 1 corresponding row inLeaderboardDeffor each week - for each weekly
Competitioncreated above, 1Prizerow for each prize given in the--weekly-prizelist. - 1 row in
Competition+ 1 corresponding row inLeaderboardDeffor each month - for each monthly
Competitioncreated above, 1Prizerow for each prize given in the--monthly-prizelist. - 1
ProviderCountryrow for each country code given. - 5
ProviderPagerows with the following name: landing, enrollment, terms, rules, outbound. They are used for analytics purpose. - 1
Advertisementrow for theProvidercreated above, the outbound name default to the Provider name.
The prize currency option is used to format the message in the Prize and Competition row.
You will need to edit manually the raw of the newly created Provider to enter the marketing messages.
There is a set of generic assets located at TH_API/WebClient/competitionPages/img/brokerCo
There is a script that copy the list of assets under brokerCo and rename them so that any brokerco occurrence in the file names is replaced with MyCompetition.
The script takes 2 input parameters
- the name of the new competition
MyCompetition - the path to the directory containing the
brokerCoimage directory.
./competition-copy-assets.sh MyCompetition ~/code/TH_SVR/TH_API/WebClient/competitionPages/img
You now should have a new directory MyCompetition containing the assets from the brokerCo folder but with any reference to brokerCo in the file name replaced with MyCompetition.
The new assets are now on disk at the right location, we need to add them to the visual studio solution. First make sure you enable the Project > Show All Files option.
In the solution explorer, right click on the folder TH_API/WebClient/competitionPages/img/{MyCompetition} and choose Include In Project.
You first need to find out what is the id of the Provider row that was created for the competition in the first step.
All the html pages specific to competitions are located at TH_API/Views/CompetitionPages. For each type of page, there is a container page which renders a specific template based on the provider.
For instance, for the BrokerCo provider (id=17), the Rules.cshtml page will render the template Rules/_RulesProvider17.cshtml.
There is a script that copy the brokerCo pages and rename them for the new provider we are creating. The script is invoked as follow:
./competition-copy-html.sh ID NAME PATH OUTBOUND_NAME
where:
-
idis the id of the new provider we created in the earlier step -
NAMEis the name of the new provider we created in the earlier step -
PATHis the path to the directory containing the competition html pages. -
OUTBOUND_NAMEis a list of the outbound screen to create - there should be 1 outbound name per advertisement created in the first step. the name of the outbound page to create should match theoutboundNamecolumn on theAdvertisemententity created in the first step.
./competition-copy-html.sh 123 MyCompetition ~/code/TH_SVR/TH_API/Views/CompetitionPages MyCompetition
The new assets are now on disk at the right location, we need to add them to the visual studio solution. In the solution explorer right click on the folders where the new files where created and add them using Add > Existing Item.
You need to create 2 C# classes that represent the forms being sent to the server when the user signs up for the competition or fill in an outbound form.
Create a subclass of CompetitionFormDTO, the existing subclasses are located at TH_COMMON/DTOs/Competitions/Enroll.
You will need to modify the switch statement to take into account the new provider in the ProviderExtensions.cs
You will also need to update the _EnrollmentFormProviderXX.cshtml that was created in the previous step to integrate with the new form. Pay attention to the @model directive and any method used to build the form dynamically: here and here.
Of course, you can also totally change the html page and create whatever properties are necessary in your DTO class.
You will need to update the query fetching the tradable securities for the new Provider in ProviderExtension.cs
Create a subclass of OutboundFormDTO, the existing subclasses are located at TH_COMMON/DTOs/Competitions/Outbound.
You will need to modify the switch statement to take into account the new provider in the AdvertisementExtension.cs
You will also need to update the _OutboundProviderXX_Outbound_YY.cshtml that was created in the previous step to integrate with the new form. Pay attention to the @model directive.
Of course, you can also totally change the html page and create whatever properties are necessary in your DTO class.
set the new Provider active flag to true.
update Provider set active = 1 where id = XXX