Skip to content

Commit

Permalink
Merge pull request #1 from obcode/rewriteDataStructure
Browse files Browse the repository at this point in the history
Rewrite data structure
  • Loading branch information
obcode authored Feb 16, 2024
2 parents b432b57 + 9aa92f6 commit ef92fd8
Show file tree
Hide file tree
Showing 108 changed files with 22,394 additions and 9,025 deletions.
28 changes: 22 additions & 6 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,28 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: "1.20"
cache: false
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v2
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0
args: --timeout=10m

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the action will use pre-installed Go.
# skip-go-installation: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
31 changes: 15 additions & 16 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug plexams.go",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "main.go",
"args": ["validate", "all"]
}

]
}
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug plexams.go",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "main.go",
"args": []
}
]
}
105 changes: 93 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,103 @@

# plexams.go

Rewrite of obcode/plexams in Go
- Import aus ZPA -- daher nicht verändern!
- teachers
- zpaexams

## Config `plexams.yaml`
## Datenmodell

## Run GraphQL server

```
plexams.go server
```mermaid
erDiagram
teachers
zpaexams
zpaexamsToPlan {
int ancode
bool toPlan
}
zpaexams ||--|| zpaexamsToPlan: planOrNot
constraints |o--|| zpaexams: hasConstraint
zpaexams |o--o{ exams_primuss: connectedExam
externalExams {
int ancode
string program
}
```

## Fetch from ZPA
additionalExam |o--o{ exams_primuss: connectedAdditionalExam

```
plexams.go zpa teacher
```
conflicts_XY
count_XY
exams_XY
studentregs_XY

## Ablauf

```mermaid
flowchart TD
ZPA_Exams --> Connected_Exams
Primuss_Exams --> Connected_Exams
Connected_Exams --> Exams/Cached_Exams
Primuss_StudentRegs/Conflicts --> Exams/Cached_Exams
NTAs --> Exams/Cached_Exams
```
plexams.go zpa exams
```

1. Prüfungen aus dem ZPA importieren (bei Änderungen erneut):

```
plexams.go zpa exams
```

2. Dozierende aus dem ZPA importieren (bei Änderungen erneut):

```
plexams.go zpa teacher
```

3. Prüfungen in `plexams.gui` auswählen, die geplant werden müssen.
4. (optional) zusätzliche Prüfungen einfügen, die beachtet werden müssen.
5. Besonderheiten (`constraints`) bei Prüfungen einpflegen.
6. Primuss-Daten per `Makefile` importieren.
7. Zuordnung ZPA <-> Primuss:

```
plexams.go prepare connected-exams
```

Kontrollieren in `plexams.gui`.

8. Evtl. Primuss-Anmeldungen korrigieren

```
plexams.go primuss fix-ancode <program> <old-ancode> <new-ancode>
```

und erneut zuordnen lassen (siehe 7.) oder zusätzlich zuordnen (siehe 9.)

9. Evtl. mit

```
plexams.go prepare connect-exam <ancode> <program>
```

ein zusätzliches connecten

10. Primuss-Anmeldungen ins ZPA importieren

```
plexams.go zpa studentregs
```
11. Zuordnung ZPA-Prüfungen zu Primuss-Anmeldungen fixieren.
12. Nachteilsausgleiche bei Prüfer:innen per E-Mail melden/nachfragen
```
plexams.go email nta -r
```
bis hier
13. MUC.DAI-Planung an Prüfungsplaner FK03 (DE), FK08 (GS), FK12 (ID)
14. Vorläufigen Plan ins ZPA und an Fachschaft
15. Plan im ZPA veröffentlichen
16. E-Mail Anforderungen an die Aufsichtenplanung
65 changes: 65 additions & 0 deletions cmd/cache.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package cmd

import (
"fmt"
"log"
"os"
"strconv"

"github.com/logrusorgru/aurora"
"github.com/spf13/cobra"
)

var (
cacheCmd = &cobra.Command{
Use: "cache",
Short: "cache [subcommand]",
Long: `cache collections.
exam <ancode>
exams
rm-exams
`,
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
plexams := initPlexamsConfig()
switch args[0] {

case "exam":
if len(args) < 2 {
log.Fatal("need ancode")
}
ancode, err := strconv.Atoi(args[1])
if err != nil {
fmt.Printf("cannot use %s as ancode", args[1])
os.Exit(1)
}

err = plexams.CacheExam(ancode)
if err != nil {
os.Exit(1)
}

case "exams":
err := plexams.CacheExams()
if err != nil {
os.Exit(1)
}

case "rm-exams":
err := plexams.RmCacheExams()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Println(aurora.Green("successfully removed the cached exams"))

default:
fmt.Println("cache called with unknown sub command")
}
},
}
)

func init() {
rootCmd.AddCommand(cacheCmd)
}
57 changes: 57 additions & 0 deletions cmd/csv.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package cmd

import (
"fmt"
"log"
"os"

"github.com/spf13/cobra"
)

var (
csvCmd = &cobra.Command{
Use: "csv",
Short: "csv [subcommand]",
Long: `Generate various CSVs.
draft [program] - generate csv for program
exahm - csv for EXaHM/SEB exams.`,
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
plexams := initPlexamsConfig()
switch args[0] {
case "draft":
if len(args) < 2 {
log.Fatal("need program")
}
program := args[1]
if len(Csvfile) == 0 {
Csvfile = fmt.Sprintf("VorläufigePrüfungsplanung_FK07_%s.csv", program)
}
fmt.Printf("generating %s\n", Csvfile)
err := plexams.CsvForProgram(program, Csvfile)
if err != nil {
os.Exit(1)
}

case "exahm":
if len(Csvfile) == 0 {
Csvfile = "Prüfungsplanung_EXaHM_SEB_FK07.csv"
}
fmt.Printf("generating %s\n", Csvfile)
err := plexams.CsvForEXaHM(Csvfile)
if err != nil {
os.Exit(1)
}

default:
fmt.Println("pdf called with unknown sub command")
}
},
}
Csvfile string
)

func init() {
rootCmd.AddCommand(csvCmd)
csvCmd.Flags().StringVarP(&Csvfile, "out", "o", "", "output (csv) file")
}
14 changes: 13 additions & 1 deletion cmd/email.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ var (
Use: "email [subcommand]",
Short: "send email",
Long: `Send emails.
nta --- send emails to teachers about nta.`,
nta --- send emails to teachers about nta,
nta-with-room-alone --- send emails to students with room alone,
primuss-data --- send emails to teachers about primuss data and nta.`,
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
plexams := initPlexamsConfig()
Expand All @@ -23,6 +25,16 @@ nta --- send emails to teachers about nta.`,
if err != nil {
log.Fatalf("got error: %v\n", err)
}
case "nta-with-room-alone":
err := plexams.SendHandicapsMailsNTARoomAlone(context.Background(), run)
if err != nil {
log.Fatalf("got error: %v\n", err)
}
case "primuss-data":
err := plexams.SendGeneratedExamMails(context.Background(), run)
if err != nil {
log.Fatalf("got error: %v\n", err)
}
default:
fmt.Println("email called with unknown sub command")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ plan --- generate the plan.`,
plexams := initPlexamsConfig()
switch args[0] {
case "plan":
err := plexams.GeneratePlan(context.Background())
err := plexams.GeneratePlan(context.Background()) // nolint
if err != nil {
log.Fatalf("got error: %v\n", err)
}
Expand Down
Loading

0 comments on commit ef92fd8

Please sign in to comment.