From 6cf9eb0de1f6a4bee6655ada346f96d4ae5c21af Mon Sep 17 00:00:00 2001 From: hanemile Date: Sun, 19 Jul 2020 16:51:20 +0200 Subject: removed merge conflicts --- src/db.go | 12 ------------ src/db/go.mod | 3 --- src/db/go.sum | 3 --- src/db/talk.go | 18 ------------------ src/http.go | 24 ------------------------ 5 files changed, 60 deletions(-) (limited to 'src') diff --git a/src/db.go b/src/db.go index 1ec0941..dfd5093 100644 --- a/src/db.go +++ b/src/db.go @@ -61,31 +61,19 @@ func createSomeTalks(pgdb *pg.DB) { "Bombur", } for i := 0; i < 10; i++ { -<<<<<<< HEAD date := time.Now().Add(-3 * 7 * 24 * time.Hour).Add(time.Duration(i) * 7 * 24 * time.Hour) -======= - date := time.Now().Add(time.Duration(i) * 7 * 24 * time.Hour) ->>>>>>> refs/remotes/origin/master layout := "2006-01-02" formattedDate := date.Format(layout) talk := &structs.Talk{ UUID: uuid.New(), -<<<<<<< HEAD Title: fmt.Sprintf("Wie baut man eigentlich Raketen ohne Brennstoff? nr. %d", i), Description: fmt.Sprintf("Sunt rerum illo corrupti. Similique qui rem debitis. Accusamus et rerum sint et amet eos nemo. Et enim omnis et. Tempora et corrupti aut ea et vel. \n Dolor est quae sed molestiae nisi esse aliquid atque. Voluptas vero et ducimus voluptatem in eaque. Quo illum et delectus vel sed molestias quidem. Consequuntur unde dolores quis sunt exercitationem eos et provident. Animi eaque temporibus alias. %d", i), Slides: "./uploads/black.png", Nickname: nicknames[rand.Intn(len(nicknames))], Date: date, -======= - Title: fmt.Sprintf("Wie baut man eigentlich Raketen ohne Brennstoff nr. %d", i), - Description: fmt.Sprintf("Sunt rerum illo corrupti. Similique qui rem debitis. Accusamus et rerum sint et amet eos nemo. Et enim omnis et. Tempora et corrupti aut ea et vel. \n Dolor est quae sed molestiae nisi esse aliquid atque. Voluptas vero et ducimus voluptatem in eaque. Quo illum et delectus vel sed molestias quidem. Consequuntur unde dolores quis sunt exercitationem eos et provident. Animi eaque temporibus alias. %d", i), - Slides: "./uploads/black.png", - Nickname: nicknames[rand.Intn(len(nicknames))], - Date: time.Now(), ->>>>>>> refs/remotes/origin/master FormattedDate: formattedDate, Upcoming: true, } diff --git a/src/db/go.mod b/src/db/go.mod index 2c20fbf..64c66b8 100644 --- a/src/db/go.mod +++ b/src/db/go.mod @@ -3,10 +3,7 @@ module git.darknebu.la/chaosdorf/freitagsfoo/src/db go 1.13 require ( -<<<<<<< HEAD git.darknebu.la/chaosdorf/freitagsfoo/src/structs v0.0.0-20200718235609-fc63adf55849 -======= ->>>>>>> refs/remotes/origin/master github.com/go-pg/pg/v9 v9.1.6 github.com/google/uuid v1.1.1 github.com/sirupsen/logrus v1.6.0 diff --git a/src/db/go.sum b/src/db/go.sum index 5efb5a8..e0d640e 100644 --- a/src/db/go.sum +++ b/src/db/go.sum @@ -11,12 +11,9 @@ cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqCl cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -<<<<<<< HEAD git.darknebu.la/chaosdorf/freitagsfoo v0.0.0-20200718235609-fc63adf55849 h1:xI4zrY9O8OoR7ais9O+b+ntKoKi4Ln4mb2iUys/e66k= git.darknebu.la/chaosdorf/freitagsfoo/src/structs v0.0.0-20200718235609-fc63adf55849 h1:dkaulG2hAwns3QvFwFQEq2DVhiRsGPKvDmV5VrI3sfQ= git.darknebu.la/chaosdorf/freitagsfoo/src/structs v0.0.0-20200718235609-fc63adf55849/go.mod h1:dxRyc1J0ktxxbrlUpd3Uujtx+KgGGidcIpfFBT5ftBc= -======= ->>>>>>> refs/remotes/origin/master github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= diff --git a/src/db/talk.go b/src/db/talk.go index 34a245a..8e835e1 100644 --- a/src/db/talk.go +++ b/src/db/talk.go @@ -2,11 +2,7 @@ package db import ( "fmt" -<<<<<<< HEAD "time" -======= ->>>>>>> refs/remotes/origin/master - "git.darknebu.la/chaosdorf/freitagsfoo/src/structs" pg "github.com/go-pg/pg/v9" "github.com/google/uuid" @@ -25,11 +21,7 @@ func InsertTalk(db *pg.DB, talk *structs.Talk) error { // UpcomingTalksLimited returns the next 3 upcoming talks func UpcomingTalksLimited(db *pg.DB) ([]structs.Talk, error) { var talks []structs.Talk -<<<<<<< HEAD err := db.Model(&talks).Order("date ASC").Where("date > ?", time.Now()).Limit(3).Select() -======= - err := db.Model(&talks).Order("id DESC").Limit(3).Select() ->>>>>>> refs/remotes/origin/master if err != nil { return []structs.Talk{}, fmt.Errorf("could not get the talks from the db: %s", err) } @@ -40,7 +32,6 @@ func UpcomingTalksLimited(db *pg.DB) ([]structs.Talk, error) { // UpcomingTalks returns the next upcoming talks func UpcomingTalks(db *pg.DB) ([]structs.Talk, error) { var talks []structs.Talk -<<<<<<< HEAD err := db.Model(&talks).Order("date ASC").Where("date > ?", time.Now()).Select() if err != nil { return []structs.Talk{}, fmt.Errorf("could not get the talks from the db: %s", err) @@ -64,9 +55,6 @@ func PastTalksLimited(db *pg.DB) ([]structs.Talk, error) { func PastTalks(db *pg.DB) ([]structs.Talk, error) { var talks []structs.Talk err := db.Model(&talks).Order("date DESC").Where("date < ?", time.Now()).Select() -======= - err := db.Model(&talks).Order("id DESC").Select() ->>>>>>> refs/remotes/origin/master if err != nil { return []structs.Talk{}, fmt.Errorf("could not get the talks from the db: %s", err) } @@ -76,7 +64,6 @@ func PastTalks(db *pg.DB) ([]structs.Talk, error) { // CountUpcomingTalks counts the amount of talks upcoming func CountUpcomingTalks(db *pg.DB) (int, error) { -<<<<<<< HEAD var talks []structs.Talk count, err := db.Model(&talks).Where("date > ?", time.Now()).Where("upcoming = ?", true).SelectAndCount() if err != nil { @@ -90,11 +77,6 @@ func CountUpcomingTalks(db *pg.DB) (int, error) { func CountPastTalks(db *pg.DB) (int, error) { var talks []structs.Talk count, err := db.Model(&talks).Where("date < ?", time.Now()).SelectAndCount() -======= - - var talks []structs.Talk - count, err := db.Model(&talks).Where("upcoming = ?", true).SelectAndCount() ->>>>>>> refs/remotes/origin/master if err != nil { return -1, fmt.Errorf("could not get the talks from the db: %s", err) } diff --git a/src/http.go b/src/http.go index ec01825..823a969 100644 --- a/src/http.go +++ b/src/http.go @@ -19,10 +19,7 @@ func initHTTPServer() { r := mux.NewRouter() r.HandleFunc("/", indexHandler).Methods("GET") r.HandleFunc("/upcoming", upcomingHandler).Methods("GET") -<<<<<<< HEAD r.HandleFunc("/past", pastHandler).Methods("GET") -======= ->>>>>>> refs/remotes/origin/master r.HandleFunc("/propose", proposeHandler).Methods("GET") r.HandleFunc("/talk/{uuid}", talkHandler).Methods("GET") @@ -63,42 +60,32 @@ func indexHandler(w http.ResponseWriter, r *http.Request) { logrus.Warn(err) return } -<<<<<<< HEAD // fetch the last three talks lastThreeTalks, err := db.PastTalksLimited(pgdb) if err != nil { logrus.Warn(err) return } -======= ->>>>>>> refs/remotes/origin/master upcomingCount, err := db.CountUpcomingTalks(pgdb) if err != nil { logrus.Warn(err) return } -<<<<<<< HEAD pastCount, err := db.CountPastTalks(pgdb) if err != nil { logrus.Warn(err) return } -======= ->>>>>>> refs/remotes/origin/master content := map[string]interface{}{ "upcomingTalks": firstThreeTalks, "upcomingCount": upcomingCount, -<<<<<<< HEAD "pastTalks": lastThreeTalks, "pastCount": pastCount, "All": false, -======= - "All": false, ->>>>>>> refs/remotes/origin/master } // define a template @@ -121,11 +108,7 @@ func upcomingHandler(w http.ResponseWriter, r *http.Request) { defer db.Disconnect(pgdb) // fetch the next talks -<<<<<<< HEAD upcomingTalks, err := db.UpcomingTalks(pgdb) -======= - firstThreeTalks, err := db.UpcomingTalks(pgdb) ->>>>>>> refs/remotes/origin/master if err != nil { logrus.Warn(err) return @@ -138,11 +121,7 @@ func upcomingHandler(w http.ResponseWriter, r *http.Request) { } content := map[string]interface{}{ -<<<<<<< HEAD "upcomingTalks": upcomingTalks, -======= - "upcomingTalks": firstThreeTalks, ->>>>>>> refs/remotes/origin/master "upcomingCount": upcomingCount, "All": true, } @@ -162,7 +141,6 @@ func upcomingHandler(w http.ResponseWriter, r *http.Request) { } } -<<<<<<< HEAD func pastHandler(w http.ResponseWriter, r *http.Request) { pgdb := db.Connect() defer db.Disconnect(pgdb) @@ -201,8 +179,6 @@ func pastHandler(w http.ResponseWriter, r *http.Request) { } } -======= ->>>>>>> refs/remotes/origin/master func proposeHandler(w http.ResponseWriter, r *http.Request) { // find the date of the next friday -- cgit 1.4.1