Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
"Score table" task description

This information system, created using the lsFusion Platform, should contain the functionality for keeping score at a hockey tournament.

...

A team's score table ranking is determined by the total number of points. In case of a tie, additional parameters are considered: number of regular-time victories, number of overtime victories, number of penalty shootout victories, the difference between scores and misses, number of scores. Additional parameters for determining the final ranking are applied consecutively in a specified order until a status is achieved in which the results of the teams are uniquely ranked.

Defining the domain logic
Module declaration

We declare a module within which the required functionality will be implemented. We assign an arbitrary name to the module (for example, HockeyStats).

...

HTML Include
urlhttp://localhost:5000/samphighl?file=hockeystats%2FHockeyStats&block=require&original=1

Team definition

We introduce the concept of a team, for which we create a separate class using the corresponding instruction CLASS

...

HTML Include
urlhttp://localhost:5000/samphighl?file=hockeystats%2FHockeyStats&block=nameteam&original=1

Thus, the team name is a data (user-entered) string-type property. Using the IN option, the created property is added to the predefined base property group. Object properties belonging to the base group will be automatically displayed on the dialog form for selecting an object of the "Team" class.

Game definition

We introduce the concept of the game and its attributes: date, participants (host team and guest team), and their names.

...

The hostTeam and guestTeam properties are data object properties of a game, whose values are links to the host team and guest team, respectively (that is, to specific Team-class objects). Properties of the team names of the game hosts and guests (hostTeamName and guestTeamName) are created for subsequent use on forms. If the hostTeam and guestTeam properties are added to the form, the user will see the internal IDs of objects from the database.

...

HTML Include
urlhttp://localhost:5000/samphighl?file=hockeystats%2FHockeyStats&block=constraintgoals&original=1

Determining the winner of the game

We determine the winner of the game - the team that has scored more goals than its opponent.

...

HTML Include
urlhttp://localhost:5000/samphighl?file=hockeystats%2FHockeyStats&block=gamelooser&original=1

Determining game result

We introduce the concept of the possible game result with a predefined set of values: regular-time win, overtime win, penalty shootout win.

...

The result of the NOT userResult(game) expression will be true only if userResult(game) is not defined (that is, if it is NULL). Thus, the constraint will be violated if the score difference is 1, and the type of win is not specified by the user.

Creating a score table

The score table is the ranking of the teams in a tournament - a list of teams sorted by ranking.

...

  • all teams are arranged in a sequence (ranked) in descending order of the values of certain parameters (number of points scored, games won in regular time, and other properties specified after the ORDER DESC operator)
  • The sum of the values of the specified SUM expression (in this case, number 1) is calculated for each team. The sum is calculated for all teams preceding that team in the ranked list (including that team). That is, 1 for the first team, 1+1 for the second, 1+1+1 for the third, etc.
Defining view logic

We add an interface that allows you to work with the developed system, entering data into the system and obtaining the necessary information from it. The form being created will consist of two vertically arranged blocks, in the upper of which the user will be able to add, modify, and delete games with all their attributes, while in the lower one there will be a score table displaying the results of the games and allowing to add or delete teams and change their names.

...

The process of creating an information system is completed.

The complete source code (on GitHub)

HTML Include
urlhttp://localhost:5000/samphighl?file=hockeystats%2FHockeyStats