admin&sync: insert format helper in database

This commit is contained in:
nemunaire 2018-09-09 22:28:39 +02:00 committed by Pierre-Olivier Mercier
parent 971273a185
commit 2a6fbd4e32
6 changed files with 22 additions and 17 deletions

View file

@ -190,6 +190,7 @@ func deleteExerciceHint(hint fic.EHint, _ []byte) (interface{}, error) {
type uploadedKey struct {
Label string
Help string
Key string
Hash []byte
}
@ -204,7 +205,7 @@ func createExerciceKey(exercice fic.Exercice, body []byte) (interface{}, error)
return nil, errors.New("Key not filled")
}
return exercice.AddRawKey(uk.Label, uk.Key)
return exercice.AddRawKey(uk.Label, uk.Help, uk.Key)
}
func showExerciceKey(key fic.Key, _ fic.Exercice, body []byte) (interface{}, error) {
@ -223,6 +224,7 @@ func updateExerciceKey(key fic.Key, exercice fic.Exercice, body []byte) (interfa
key.Label = uk.Label
}
key.Help = uk.Help
key.Checksum = uk.Hash
if _, err := key.Update(); err != nil {