frontend: don't reuse tries in public interface; use a separate field to store total tries count for an exercice; and display it in interface
This commit is contained in:
parent
6c03d04f36
commit
8790d6d678
3 changed files with 5 additions and 1 deletions
|
@ -536,6 +536,8 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
||||||
|
|
||||||
if (check !== undefined)
|
if (check !== undefined)
|
||||||
{
|
{
|
||||||
|
if (!$scope.my.exercices[$rootScope.current_exercice].tries)
|
||||||
|
$scope.my.exercices[$rootScope.current_exercice].tries = 0;
|
||||||
$scope.my.exercices[$rootScope.current_exercice].tries += 1;
|
$scope.my.exercices[$rootScope.current_exercice].tries += 1;
|
||||||
$scope.my.exercices[$rootScope.current_exercice].solved_time = new Date();
|
$scope.my.exercices[$rootScope.current_exercice].solved_time = new Date();
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
<hr class="my-3">
|
<hr class="my-3">
|
||||||
<ul>
|
<ul>
|
||||||
<li><strong>Gain :</strong> <ng-pluralize count="themes[current_theme].exercices[current_exercice].gain" when="{'one': '{} point', 'other': '{} points'}"></ng-pluralize> <em ng-if="settings.firstBlood && themes[current_theme].exercices[current_exercice].solved < 1">{{ 1 + settings.firstBlood | coeff }} prem's</em> <em ng-if="themes[current_theme].exercices[current_exercice].curcoeff != 1.0 || settings.exerciceCurrentCoefficient">{{ themes[current_theme].exercices[current_exercice].curcoeff * settings.exerciceCurrentCoefficient | coeff }} bonus</em></li>
|
<li><strong>Gain :</strong> <ng-pluralize count="themes[current_theme].exercices[current_exercice].gain" when="{'one': '{} point', 'other': '{} points'}"></ng-pluralize> <em ng-if="settings.firstBlood && themes[current_theme].exercices[current_exercice].solved < 1">{{ 1 + settings.firstBlood | coeff }} prem's</em> <em ng-if="themes[current_theme].exercices[current_exercice].curcoeff != 1.0 || settings.exerciceCurrentCoefficient">{{ themes[current_theme].exercices[current_exercice].curcoeff * settings.exerciceCurrentCoefficient | coeff }} bonus</em></li>
|
||||||
|
<li ng-if="themes[current_theme].exercices[current_exercice].tried"><strong>Tenté par :</strong> <ng-pluralize count="themes[current_theme].exercices[current_exercice].tried" when="{'0': 'aucune équipe', 'one': '{} équipe', 'other': '{} équipes'}"></ng-pluralize> <span ng-if="my.exercices[current_exercice].total_tries">(cumulant <ng-pluralize count="my.exercices[current_exercice].total_tries" when="{'one': '{} tentative', 'other': '{} tentatives'}"></ng-pluralize>)</span>.</li>
|
||||||
<li><strong>Résolu par :</strong> <ng-pluralize count="themes[current_theme].exercices[current_exercice].solved" when="{'0': 'aucune équipe', 'one': '{} équipe', 'other': '{} équipes'}"></ng-pluralize>.</li>
|
<li><strong>Résolu par :</strong> <ng-pluralize count="themes[current_theme].exercices[current_exercice].solved" when="{'0': 'aucune équipe', 'one': '{} équipe', 'other': '{} équipes'}"></ng-pluralize>.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -64,6 +64,7 @@ type myTeamExercice struct {
|
||||||
SolvedTime *time.Time `json:"solved_time,omitempty"`
|
SolvedTime *time.Time `json:"solved_time,omitempty"`
|
||||||
SolvedRank int64 `json:"solved_rank,omitempty"`
|
SolvedRank int64 `json:"solved_rank,omitempty"`
|
||||||
Tries int64 `json:"tries,omitempty"`
|
Tries int64 `json:"tries,omitempty"`
|
||||||
|
TotalTries int64 `json:"total_tries,omitempty"`
|
||||||
VideoURI string `json:"video_uri,omitempty"`
|
VideoURI string `json:"video_uri,omitempty"`
|
||||||
Issue string `json:"issue,omitempty"`
|
Issue string `json:"issue,omitempty"`
|
||||||
IssueKind string `json:"issuekind,omitempty"`
|
IssueKind string `json:"issuekind,omitempty"`
|
||||||
|
@ -114,7 +115,7 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
|
||||||
exercice.Overview = strings.Replace(e.Overview, "$FILES$", FilesDir, -1)
|
exercice.Overview = strings.Replace(e.Overview, "$FILES$", FilesDir, -1)
|
||||||
exercice.Finished = strings.Replace(e.Finished, "$FILES$", FilesDir, -1)
|
exercice.Finished = strings.Replace(e.Finished, "$FILES$", FilesDir, -1)
|
||||||
exercice.VideoURI = e.VideoURI
|
exercice.VideoURI = e.VideoURI
|
||||||
exercice.Tries = e.TriedCount()
|
exercice.TotalTries = e.TriedCount()
|
||||||
exercice.Gain = int(float64(e.Gain) * e.Coefficient)
|
exercice.Gain = int(float64(e.Gain) * e.Coefficient)
|
||||||
} else {
|
} else {
|
||||||
solved, stime := t.HasSolved(e)
|
solved, stime := t.HasSolved(e)
|
||||||
|
|
Reference in a new issue