Skip to content

Commit

Permalink
Add source realtime
Browse files Browse the repository at this point in the history
  • Loading branch information
berejant committed Oct 12, 2023
1 parent ea066d4 commit ed7e6e0
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 16 deletions.
1 change: 1 addition & 0 deletions deletedScoresImporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ func (importer *DeletedScoresImporter) pullDeletedScores() error {

var event events.ScoreEvent
event.SyncedAt = time.Now()
event.ScoreSource = events.Realtime
for rows.Next() {
err = rows.Scan(
&event.Id, &event.StudentId,
Expand Down
9 changes: 6 additions & 3 deletions deletedScoresImporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ func TestExecuteImportDeletedScores(t *testing.T) {
IsAbsent: false,
IsDeleted: true,
},
SyncedAt: syncedAtRewrite,
SyncedAt: syncedAtRewrite,
ScoreSource: events.Realtime,
}

lessonDeletedEvent := dekanatEvents.LessonDeletedEvent{
Expand Down Expand Up @@ -132,7 +133,8 @@ func TestExecuteImportDeletedScores(t *testing.T) {
IsAbsent: false,
IsDeleted: false,
},
SyncedAt: syncedAtRewrite,
SyncedAt: syncedAtRewrite,
ScoreSource: events.Realtime,
}

lessonDeletedEvent := dekanatEvents.LessonDeletedEvent{
Expand Down Expand Up @@ -210,7 +212,8 @@ func TestExecuteImportDeletedScores(t *testing.T) {
IsAbsent: false,
IsDeleted: false,
},
SyncedAt: syncedAtRewrite,
SyncedAt: syncedAtRewrite,
ScoreSource: events.Realtime,
}

lessonDeletedEvent := dekanatEvents.LessonDeletedEvent{
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/sqs v1.24.5
github.com/joho/godotenv v1.4.0
github.com/kneu-messenger-pigeon/dekanat-events v0.1.5
github.com/kneu-messenger-pigeon/events v0.1.40
github.com/kneu-messenger-pigeon/events v0.1.41
github.com/kneu-messenger-pigeon/fileStorage v1.0.1
github.com/mattn/go-sqlite3 v1.14.16
github.com/nakagami/firebirdsql v0.9.4
Expand Down
10 changes: 2 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,10 @@ github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uia
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQanqjSY=
github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU=
github.com/kneu-messenger-pigeon/dekanat-events v0.1.1 h1:XsoYyvqmahJmZrhR4/0Jw6/h+5bmvz+VzKuL/2l9GHs=
github.com/kneu-messenger-pigeon/dekanat-events v0.1.1/go.mod h1:KC0hflA3057dtpg2Mtpbhma9Z3n8Y43vwyygZODzO/Y=
github.com/kneu-messenger-pigeon/dekanat-events v0.1.2 h1:fqWPIB8/RUN54/RJxpkmsSyGHwMhkR++WJbdI6+11pE=
github.com/kneu-messenger-pigeon/dekanat-events v0.1.2/go.mod h1:KC0hflA3057dtpg2Mtpbhma9Z3n8Y43vwyygZODzO/Y=
github.com/kneu-messenger-pigeon/dekanat-events v0.1.3 h1:RqsPXCrBjkONEaYPPTo5W3q9FULSjRi6qNUDnoBYI54=
github.com/kneu-messenger-pigeon/dekanat-events v0.1.3/go.mod h1:KC0hflA3057dtpg2Mtpbhma9Z3n8Y43vwyygZODzO/Y=
github.com/kneu-messenger-pigeon/dekanat-events v0.1.5 h1:nmNFE/zaZtFkeLrlXrxBk1kQrZ8/pe00c228uWeERsQ=
github.com/kneu-messenger-pigeon/dekanat-events v0.1.5/go.mod h1:KC0hflA3057dtpg2Mtpbhma9Z3n8Y43vwyygZODzO/Y=
github.com/kneu-messenger-pigeon/events v0.1.40 h1:Ov5Ny7h5KGmxMFT5k6UPikun+LeQEymdIe3aATuzcRo=
github.com/kneu-messenger-pigeon/events v0.1.40/go.mod h1:Q6X8B9gKZpKbby9gisLumvGT1xCWBM7bAFnviYi6MBQ=
github.com/kneu-messenger-pigeon/events v0.1.41 h1:Yzzp7oyVArzKzzI93HmLX+k3lUn8E3dKUk9uNF3le+8=
github.com/kneu-messenger-pigeon/events v0.1.41/go.mod h1:Q6X8B9gKZpKbby9gisLumvGT1xCWBM7bAFnviYi6MBQ=
github.com/kneu-messenger-pigeon/fileStorage v1.0.1 h1:9ncIZaUXDv5SwB5KtWae/CSYYye1m/z4R7hU1WmBnWQ=
github.com/kneu-messenger-pigeon/fileStorage v1.0.1/go.mod h1:v6IRKfG5C45B6Ls6781bmnLNwAE3e6ZcWuU0N55l66M=
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
Expand Down
1 change: 1 addition & 0 deletions updatedScoresImporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ func (importer *UpdatedScoresImporter) pullUpdatedScores() error {
}
var event events.ScoreEvent
event.SyncedAt = time.Now()
event.ScoreSource = events.Realtime
nextLastRegDate := importer.getLastRegDate()
for rows.Next() {
err = rows.Scan(
Expand Down
12 changes: 8 additions & 4 deletions updatedScoresImporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ func TestExecuteImportUpdatedScores(t *testing.T) {
IsAbsent: false,
IsDeleted: true,
},
SyncedAt: syncedAtRewrite,
SyncedAt: syncedAtRewrite,
ScoreSource: events.Realtime,
}

updatedScoreEvent := dekanatEvents.ScoreEditEvent{
Expand Down Expand Up @@ -154,7 +155,8 @@ func TestExecuteImportUpdatedScores(t *testing.T) {
IsAbsent: false,
IsDeleted: false,
},
SyncedAt: syncedAtRewrite,
SyncedAt: syncedAtRewrite,
ScoreSource: events.Realtime,
}

updateScoreEvent := dekanatEvents.ScoreEditEvent{
Expand Down Expand Up @@ -232,8 +234,9 @@ func TestExecuteImportUpdatedScores(t *testing.T) {
IsAbsent: false,
IsDeleted: false,
},
SyncedAt: syncedAtRewrite,
UpdatedAt: syncedAtRewrite.Add(-time.Minute),
SyncedAt: syncedAtRewrite,
UpdatedAt: syncedAtRewrite.Add(-time.Minute),
ScoreSource: events.Realtime,
}

updateScoreEvent := dekanatEvents.ScoreEditEvent{
Expand Down Expand Up @@ -335,6 +338,7 @@ func TestImportUpdatedScoresLesson(t *testing.T) {
IsAbsent: false,
IsDeleted: false,
},
ScoreSource: events.Realtime,
}

updateScoreEvent := dekanatEvents.ScoreEditEvent{
Expand Down

0 comments on commit ed7e6e0

Please sign in to comment.