Merge branch 'master' into production

This commit is contained in:
Andrea Fazzi 2021-03-04 13:07:38 +01:00
commit 586900db51
10 changed files with 49 additions and 27 deletions

View file

@ -1 +1 @@
0.9.9-63-g0faa3c0-production
0.9.9-63-g0faa3c0-production

View file

@ -29,6 +29,7 @@ var (
"Umbria",
"Valle d'Aosta",
"Veneto",
"ESTERO",
}
regionsMap = map[string]uint{
"Abruzzo": 1,
@ -51,6 +52,7 @@ var (
"Umbria": 18,
"Valle d'Aosta": 19,
"Veneto": 20,
"ESTERO": 21,
}
)

View file

@ -28,14 +28,14 @@ password: {{.Password}}
Per accedere alla pagina di login occorrerà seguire questo link
https://iscrizioni.olimpiadi-economiaefinanza.it/
https://piattaforma.olimpiadi-economiaefinanza.it/
ed inserire le credenziali riportate sopra (si consiglia di effettuare un copia/incolla).
Questa mail è stata generata da un sistema automatico, si prega di non rispondere.
Cordialmente,
Lo Staff delle OEF 2020.
Lo Staff delle OEF 2021.
`
type School struct {

View file

@ -15,12 +15,13 @@ import (
)
type Response struct {
Firstname string
Lastname string
School string
Region string
Score int
Duration uint
Firstname string `csv:"Nome"`
Lastname string `csv:"Cognome"`
FiscalCode string `csv:"Codice fiscale"`
School string `csv:"Scuola"`
Region string `csv:"Regione"`
Score int `csv:"Punteggio"`
Duration uint `csv:"Durata"`
}
func findAnswer(answers []*orm.Answer, id uint) (*orm.Answer, error) {
@ -118,19 +119,24 @@ func main() {
panic(err)
}
school, err := findSchool(schools, r.Participant.SchoolID)
csvResponses = append(
csvResponses,
&Response{
Firstname: r.Participant.Firstname,
Lastname: r.Participant.Lastname,
School: school.String(),
Region: school.Region.String(),
Score: r.Score,
Duration: uint(r.Duration / time.Second),
},
)
if r.Score > 0 && r.Duration > 0 {
school, err := findSchool(schools, r.Participant.SchoolID)
if err != nil {
panic(err)
}
csvResponses = append(
csvResponses,
&Response{
Firstname: r.Participant.Firstname,
Lastname: r.Participant.Lastname,
FiscalCode: r.Participant.FiscalCode,
School: school.String(),
Region: school.Region.String(),
Score: r.Score,
Duration: uint(r.Duration / time.Second),
},
)
}
}
f, err := os.Create(*output)

Binary file not shown.

View file

@ -3,6 +3,7 @@ package main
import (
"flag"
"log"
"os"
"git.andreafazzi.eu/andrea/oef/client"
"git.andreafazzi.eu/andrea/oef/orm"
@ -21,6 +22,7 @@ func main() {
username := flag.String("username", "admin", "Username")
password := flag.String("password", "admin", "Password")
subscribe := flag.Bool("subscribe", true, "Subscribe to the given contest")
unsubscribeAll := flag.Bool("unsubscribe-all", false, "Unsubscribe all participants from all contests")
juniorContestId := flag.Int("jid", 0, "Contest ID for Junior category")
seniorContestId := flag.Int("sid", 0, "Contest ID for Senior category")
@ -40,6 +42,18 @@ func main() {
var updated bool
if *unsubscribeAll {
for _, participant := range participants {
participant.ContestIDs = make(orm.ContestIDs, 0)
id, err := client.Update(participant)
if err != nil {
panic(err)
}
log.Printf("Successfully updated participant ID %d", id)
}
os.Exit(0)
}
if *subscribe {
for _, participant := range participants {
for _, contest := range participant.Contests {

View file

@ -32,7 +32,7 @@
{{- if $isSchool}}{{$homeURL = "#"}}{{end -}}
<a class="navbar-brand" {{if $isAdmin}}href="{{$homeURL}}"{{end}}>
<span class="fa fa-landmark"></span>
OEF 2020
OEF 2021
</a>
<button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="navbar-toggler-icon"></span>

View file

@ -9,7 +9,7 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.css">
<link rel="stylesheet" href="/styles.css" />
<title>OEF 2020</title>
<title>OEF 2021</title>
<style>
html {
position: relative;
@ -37,7 +37,7 @@
<footer class="footer text-center">
<div class="container">
<span class="text-center text-muted">© 2020 <a href="https://www.olimpiadi-economiaefinanza.it">Olimpiadi di Economia e Finanza</a> ({{version}})
<span class="text-center text-muted">© 2021 <a href="https://www.olimpiadi-economiaefinanza.it">Olimpiadi di Economia e Finanza</a> ({{version}})
</span>
</div>
</footer>

View file

@ -2,7 +2,7 @@
<div class="container">
<h1 class="text-center karmen-title">
<span class="fa fa-landmark"></span>
OEF 2020
OEF 2021
<small>La piattaforma di gara</small>
</h1>
<div class="login">

View file

@ -2,7 +2,7 @@
<div class="container">
<h1 class="text-center karmen-title">
<span class="fa fa-landmark"></span>
OEF 2020
OEF 2021
<small>La piattaforma di gara</small>
</h1>
<div class="login">