Skip to content

Commit

Permalink
Generate HTML for all available data files
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-yagodin committed Jun 23, 2021
1 parent 3ca83a0 commit 76b9232
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions R7.Enrollment.Tests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,25 @@ public class Program
{
static void Main (string[] args)
{
var db = new TandemRatingsDb ();
db.Load ("./data/enr_rating_1696453372720271613.xml");
//db.Load ("./data/enr_rating_1697112374642823421.xml");

RenderToFile (db, "output-print.html", new TandemRatingsRendererSettings ());
RenderToFile (db, "output-web.html", new TandemRatingsRendererSettings {
var printSettings = new TandemRatingsRendererSettings ();
var webSettings = new TandemRatingsRendererSettings {
UseBasicCompetitionHeader = true
});
};

Directory.CreateDirectory ("output");

var dataFiles = Directory.GetFiles ("./data", "enr_rating_*.xml");
foreach (var dataFile in dataFiles) {
var db = new TandemRatingsDb ();
db.Load (dataFile);
RenderToFile (db, $"./output/{FilenameFromCampaignTitle (db.EntrantRatingEnvironment.CampaignTitle)}-print.html", printSettings);
RenderToFile (db, $"./output/{FilenameFromCampaignTitle (db.EntrantRatingEnvironment.CampaignTitle)}-web.html", webSettings);
}
}

static string FilenameFromCampaignTitle (string campaignTitle)
{
return campaignTitle.Replace ("21/22", "").Replace ("/", "_").Trim ().ToLower ();
}

static void RenderToFile (TandemRatingsDb db, string path, TandemRatingsRendererSettings settings)
Expand Down

0 comments on commit 76b9232

Please sign in to comment.