wiki:ScoringFormulas

Version 37 (modified by Stein Tore Erdal, 12 years ago) (diff)

--

Scoring Formulas




Create a scoring formula

Create a DLL named "!FsSf_<formula id>.dll" which implement the interface described below (found in FsFsdb.dll).

Put it in the folder where FsComp.exe is and it should show up on the list for selecting a scoring formula.

The "EditScoreFormula" method is called from FsComp when one select and edits a scoring formula.

The "ScoreTask" method is called when the menuitem Tasks > Score Task is used, or when any report is created (Reports > ...) and the task needs to be scored because there has been changes.

(any time one changes anything about one or more pilot's flightdata in a task, all FsResult? elements for that task will be removed).


using System.Xml;

/*
 * Fs/FsCompetition/FsScoreFormula
 * Fs/FsCompetition/FsTask/FsScoreFormula
 * Fs/FsCompetition/FsTask/FsParticipants/FsParticipant/FsFlightData
 * Fs/FsCompetition/FsTask/FsParticipants/FsParticipant/FsResult
*/
namespace FlightSys.FsFsdb
{
  public interface ISf
  {
    /// <summary>
    /// Should only change the FsParticipants/FsParticipant/FsResult under the xe_task_clone element.
    /// Remove any existing FsResult elements and add a new one for each pilot in task that has a FsFlightData element.
    /// FsParticipants/FsParticipant elements with no FsFlightData element is ABS and should not be counted in scoring.
    /// Empty FsFlightData element means DNF. DNF pilot may affect scoring.
    /// Best not to change anything else or FS might be confused.
    /// </summary>
    /// <param name="xe_task_clone">A clone of FsTask element. Should not have any parent.
    /// To access the rest of the fsdb xml document use OwnerDocument property of the param.</param>
    /// <param name="msg">any messages regarding scoring</param>
    /// <returns>true if task was scored, false if not.</returns>
    bool ScoreTask(XmlElement xe_task_clone, out string msg);

    /// <summary>
    /// Should provide a UI for setting scoring formula params.
    /// Should only change the xe_sf_clone element.
    /// Best not to change anything else or FS might be confused.
    /// </summary>
    /// <param name="xe_sf_clone">A clone of a FsScoreFormula element. Should not have any parent.
    /// To access the rest of the fsdb xml document use OwnerDocument property of the param.</param>
    /// <returns>Return true if any changes to xe_sf_clone where done, false if not.</returns>
    bool EditScoreFormula(XmlElement xe_sf_clone);
  }
}

Attachments (9)

Download all attachments as: .zip