From a757527e09c6bd05aab421dce343b5ac353d8eb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1lint=20R=C3=A9thelyi?= <rethelyibalint@gmail.com> Date: Wed, 22 Sep 2021 11:53:57 +0200 Subject: [PATCH] some user story --- route/route.go | 13 +++++++------ stations.yaml | 22 ++++++++++++---------- web/router.go | 6 +++--- web/templates/station.html | 2 +- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/route/route.go b/route/route.go index 497e27d..3c4c1f6 100644 --- a/route/route.go +++ b/route/route.go @@ -14,11 +14,6 @@ type Station struct { Description string } -type File struct { - Stations map[string]*Station - Stories []string -} - type User struct { Id uuid.UUID Name string @@ -37,8 +32,13 @@ type Group struct { Members []User } +type File struct { + Stations map[string]*Station + Stories map[int]string +} + var Stations map[string]*Station -var Stories []string +var Stories map[int]string func ReadFile() { b, err := ioutil.ReadFile("stations.yaml") @@ -59,6 +59,7 @@ func ReadFile() { } Stories = file.Stories + } func CreateNewRoute() []*Station { diff --git a/stations.yaml b/stations.yaml index df40a6b..c8de69a 100644 --- a/stations.yaml +++ b/stations.yaml @@ -1,23 +1,25 @@ stations: first: name: egy - description: "ez a leiras az elso allomase" + description: "105 kornyeke" 9881300f-175b-4809-b8fb-d915b2c900ac: name: rand1 - description: "ez a leiras a masodik allomase" + description: "18-on valahol" 2ab06fbd-0606-42a9-abc7-4163221d3f1f: name: rand2 - description: "ez a leiras a harmadik allomase" + description: "szauna" 7023030f-e22f-4c82-93ae-4c847b3ac964: name: rand3 - description: "ez a leiras a negyedik allomase" + description: "15-en, Feri szobajanal" last: name: uccso - description: "ez a leiras az otodik allomase" + description: "ez az AK-ban van" stories: - - "elso" - - "masodik" - - "harmadik" - - "negyedik" - - "utolso" + 1: | + Előveszed a mobilod, hogy PéK-en megnézd Feri telefonszámát. Megdöbbenve konstatálod, a telefonod nem lát semmilyen wifi hálózatot 😱, + sőőőt, látod, hogy 20%-on vagy csak, pedig felraktad töltőre mielőtt lefeküdtél (bár az hajnal 4-kor volt). + 2: "masodik" + 3: "harmadik" + 4: "negyedik" + 5: "utolso" diff --git a/web/router.go b/web/router.go index 15b2036..2f3c3c9 100644 --- a/web/router.go +++ b/web/router.go @@ -107,7 +107,7 @@ func login(c *gin.Context) { if user.Group.Route[user.StoryCounter].Id == "" { user.Group.Route[user.StoryCounter].Id = "first" user.Times["first"] = time.Now() - fmt.Println(user.Name + "accessed first station at" + user.Times["first"].String()) + fmt.Println(user.Name + " accessed first station at " + user.Times["first"].String()) } c.Redirect(http.StatusMovedPermanently, "/station/"+user.Group.Route[user.StoryCounter].Id) } @@ -140,7 +140,7 @@ func routeChooser(c *gin.Context) { break } if stat == station { - story = route.Stories[i] + story = route.Stories[i+1] if stat.Id == route.Stations["last"].Id { next = nil } else { @@ -153,7 +153,7 @@ func routeChooser(c *gin.Context) { _, ok = user.Times[stationUri.Id] if !ok { user.Times[stationUri.Id] = time.Now() - fmt.Println(user.Name + "accessed" + station.Name + "station at" + user.Times[stationUri.Id].String()) + fmt.Println(user.Name + " accessed" + station.Name + " station at " + user.Times[stationUri.Id].String()) } c.HTML(http.StatusOK, "station.html", gin.H{ diff --git a/web/templates/station.html b/web/templates/station.html index b77f94a..3a09c77 100644 --- a/web/templates/station.html +++ b/web/templates/station.html @@ -8,7 +8,7 @@ {{ .Story }} {{- if .Next }} -<p>A következő állomás leírása:</p> +<p>A következő állomást itt keressétek:</p> <p>{{ .Next.Description }}</p> <a href="/station/{{ .Next.Id }}">link debug celbol</a> {{- end }} -- GitLab