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
473332e101
commit
c4aa220b2c
|
@ -539,6 +539,8 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
|
||||
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].solved_time = new Date();
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
<hr class="my-3">
|
||||
<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 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>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -64,6 +64,7 @@ type myTeamExercice struct {
|
|||
SolvedTime *time.Time `json:"solved_time,omitempty"`
|
||||
SolvedRank int64 `json:"solved_rank,omitempty"`
|
||||
Tries int64 `json:"tries,omitempty"`
|
||||
TotalTries int64 `json:"total_tries,omitempty"`
|
||||
VideoURI string `json:"video_uri,omitempty"`
|
||||
Issue string `json:"issue,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.Finished = strings.Replace(e.Finished, "$FILES$", FilesDir, -1)
|
||||
exercice.VideoURI = e.VideoURI
|
||||
exercice.Tries = e.TriedCount()
|
||||
exercice.TotalTries = e.TriedCount()
|
||||
exercice.Gain = int(float64(e.Gain) * e.Coefficient)
|
||||
} else {
|
||||
solved, stime := t.HasSolved(e)
|
||||
|
|
Loading…
Reference in New Issue
Block a user