Skip to content

Commit 10a0b2a

Browse files
authored
Revert "Dev (#56)"
This reverts commit 5e6f38d.
1 parent 5e6f38d commit 10a0b2a

File tree

19 files changed

+230
-605
lines changed

19 files changed

+230
-605
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

.github/pull_request_template.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/go.yaml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/sonarqube.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ FROM docker.io/golang:1.24-alpine AS build
22

33
WORKDIR /src/
44
RUN apk add git
5-
COPY go.* .
6-
RUN go mod download # do this before build for caching
5+
COPY go* .
6+
COPY *.go .
77
COPY database database
88
COPY logging logging
99
COPY sse sse
10-
COPY *.go .
1110
RUN go build -v -o vote
1211

1312
FROM docker.io/alpine

README.md

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ Implementation
1111

1212
## Configuration
1313

14-
If you're using the compose file, you'll need to ask an RTP for the vote-dev OIDC secret, and set it as `VOTE_OIDC_SECRET` in your environment
15-
16-
If you're not using the compose file, you'll need more of these
14+
You'll need to set up these values in your environment. Ask an RTP for OIDC credentials. A docker-compose file is provided for convenience. Otherwise, I trust you to figure it out!
1715

1816
```
1917
VOTE_HOST=http://localhost:8080
@@ -29,34 +27,10 @@ VOTE_SLACK_APP_TOKEN=
2927
VOTE_SLACK_BOT_TOKEN=
3028
```
3129

32-
### Dev Overrides
33-
`DEV_DISABLE_ACTIVE_FILTERS="true"` will disable the requirements that you be active to vote
34-
`DEV_FORCE_IS_EVALS="true"` will force vote to treat all users as the Evals director
35-
36-
## Linting
37-
These will be checked by CI
38-
39-
```
40-
# tidy dependencies
41-
go mod tidy
42-
43-
# format all code according to go standards
44-
gofmt -w -s *.go logging sse database
45-
46-
# run tests (database is the first place we've defined tests)
47-
go test ./database
48-
49-
# run heuristic validation
50-
go vet ./database/ ./logging/ ./sse/
51-
go vet *.go
52-
```
53-
5430
## To-Dos
5531

5632
- [ ] Don't let the user fuck it up
5733
- [ ] Show E-Board polls with a higher priority
58-
- [x] Move Hide Vote to create instead of after you vote :skull:
34+
- [ ] Move Hide Vote to create instead of after you vote :skull:
5935
- [ ] Display the reason why a user is on the results page of a running poll
6036
- [ ] Display minimum time left that a poll is open
61-
- [ ] Move routes to their own functions
62-
- [ ] Change HTTP resposne codes to be `http.something` instead of just a number

constitutional.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,8 @@ func EvaluatePolls() {
151151
logging.Logger.WithFields(logrus.Fields{"method": "EvaluatePolls close"}).Error(err)
152152
continue
153153
}
154-
announceStr := "The vote \"" + poll.ShortDescription + "\" has closed."
155-
if !poll.Hidden {
156-
announceStr += " Check out the results at " + pollLink
157-
} else {
158-
announceStr += " Results will be posted shortly."
159-
}
160154
_, _, _, err = slackData.Client.SendMessage(slackData.AnnouncementsChannel,
161-
slack.MsgOptionText(announceStr, false))
155+
slack.MsgOptionText("The vote \""+poll.ShortDescription+"\" has closed. Check out the results at "+pollLink, false))
162156
if err != nil {
163157
logging.Logger.WithFields(logrus.Fields{"method": "EvaluatePolls announce"}).Error(err)
164158
}

database/database.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"os"
66
"strings"
7-
"testing"
87
"time"
98

109
"github.com/computersciencehouse/vote/logging"
@@ -21,16 +20,10 @@ const (
2120
Updated UpsertResult = 1
2221
)
2322

24-
var Client *mongo.Client = Connect()
23+
var Client = Connect()
2524
var db = ""
2625

2726
func Connect() *mongo.Client {
28-
// This always gets invoked on initialisation. bad! it'd be nice if we only did this setup in main rather than components under test. for now we just skip if testing
29-
if testing.Testing() {
30-
logging.Logger.WithFields(logrus.Fields{"module": "database", "method": "Connect"}).Info("testing, not doing db connection, someone should mock this someday")
31-
return nil
32-
}
33-
3427
logging.Logger.WithFields(logrus.Fields{"module": "database", "method": "Connect"}).Info("beginning database connection")
3528

3629
ctx, cancel := context.WithTimeout(context.TODO(), 10*time.Second)

0 commit comments

Comments
 (0)