diff --git a/app/components/jobs/timeclock/TimeclockList.vue b/app/components/jobs/timeclock/TimeclockList.vue index fd60bafad..b051e5b76 100644 --- a/app/components/jobs/timeclock/TimeclockList.vue +++ b/app/components/jobs/timeclock/TimeclockList.vue @@ -262,8 +262,8 @@ const selectedMode = computed({ }); const itemsAll = computed(() => [ - { label: t('common.time_ago.day'), icon: 'i-mdi-view-day', mode: TimeclockMode.DAILY }, - { label: t('common.time_ago.week'), icon: 'i-mdi-view-week', mode: TimeclockMode.WEEKLY }, + { label: t('common.day_view'), icon: 'i-mdi-view-day', mode: TimeclockMode.DAILY }, + { label: t('common.week_view'), icon: 'i-mdi-view-week', mode: TimeclockMode.WEEKLY }, { label: t('common.time_range'), icon: 'i-mdi-calendar-range', mode: TimeclockMode.RANGE }, ]); diff --git a/i18n/locales/en/en.json b/i18n/locales/en/en.json index 05d2452ba..4f6c2b8ac 100644 --- a/i18n/locales/en/en.json +++ b/i18n/locales/en/en.json @@ -550,7 +550,9 @@ "allowed_file_types": "PNG, JPG (MAX. 2000x1500px)", "default_lang": "Default Language", "selected": "None selected | {n} selected", - "image_caching": "Please note that due to browser caching it can take up to 4 hours for the image to have updated for everyone." + "image_caching": "Please note that due to browser caching it can take up to 4 hours for the image to have updated for everyone.", + "day_view": "Daily View", + "week_view": "Weekly View" }, "components": { "partials": { diff --git a/services/sync/account.go b/services/sync/account.go index 7243977df..1c351ec04 100644 --- a/services/sync/account.go +++ b/services/sync/account.go @@ -2,12 +2,14 @@ package sync import ( "context" + "errors" "github.com/fivenet-app/fivenet/gen/go/proto/resources/accounts" pbsync "github.com/fivenet-app/fivenet/gen/go/proto/services/sync" "github.com/fivenet-app/fivenet/pkg/utils" "github.com/fivenet-app/fivenet/query/fivenet/table" jet "github.com/go-jet/jet/v2/mysql" + "github.com/go-jet/jet/v2/qrm" ) func (s *Server) getAccount(ctx context.Context, identifier string) (*accounts.Account, *string, error) { @@ -32,7 +34,9 @@ func (s *Server) getAccount(ctx context.Context, identifier string) (*accounts.A Account: &accounts.Account{}, } if err := selectStmt.QueryContext(ctx, s.db, acc); err != nil { - return nil, nil, err + if !errors.Is(err, qrm.ErrNoRows) { + return nil, nil, err + } } return acc.Account, acc.RegToken, nil @@ -44,7 +48,7 @@ func (s *Server) RegisterAccount(ctx context.Context, req *pbsync.RegisterAccoun return nil, err } - if acc.Id > 0 { + if acc == nil || acc.Id > 0 { // Account exists and no token reset has been requested if !req.ResetToken { return &pbsync.RegisterAccountResponse{ diff --git a/services/sync/activity.go b/services/sync/activity.go index 1e10f7f55..2ced68a13 100644 --- a/services/sync/activity.go +++ b/services/sync/activity.go @@ -88,7 +88,9 @@ func (s *Server) handleUserOauth2(ctx context.Context, data *pbsync.AddActivityR LIMIT(1) if err := stmt.QueryContext(ctx, s.db, &accountId); err != nil { - return err + if !errors.Is(err, qrm.ErrNoRows) { + return err + } } if accountId == 0 { @@ -246,9 +248,9 @@ func (s *Server) handleUserUpdate(ctx context.Context, data *pbsync.AddActivityR if err := selectStmt.QueryContext(ctx, s.db, user); err != nil { if !errors.Is(err, qrm.ErrNoRows) { return err - } else { - return nil } + + return nil } updateSets := []jet.ColumnAssigment{} diff --git a/services/sync/data.go b/services/sync/data.go index 2e6cb60c0..48161624b 100644 --- a/services/sync/data.go +++ b/services/sync/data.go @@ -125,7 +125,9 @@ func (s *Server) handleJobGrades(ctx context.Context, job *users.Job) (int64, er currentGrades := []*users.JobGrade{} if err := selectStmt.QueryContext(ctx, s.db, ¤tGrades); err != nil { - return 0, err + if !errors.Is(err, qrm.ErrNoRows) { + return 0, err + } } toCreate, toUpdate, toDelete := []*users.JobGrade{}, []*users.JobGrade{}, []*users.JobGrade{} @@ -476,7 +478,9 @@ func (s *Server) handleUserLicenses(ctx context.Context, identifier string, lice currentLicenses := []string{} if err := selectStmt.QueryContext(ctx, s.db, ¤tLicenses); err != nil { - return err + if !errors.Is(err, qrm.ErrNoRows) { + return err + } } licensesList := []string{}