Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/rulesets: End to End assignment creation (KHO-172, KHO-173) #162

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

CamPlume1
Copy link
Collaborator

Checklist

  • I have performed a self-review of my code
  • I have reached out to another developer to review my code
  • I acknowledge my responsibility to reinitialize the deployed DB if there are schema changes.
  • New and existing unit tests pass locally with my changes
  • All Lint and CI checks are passing

@CamPlume1 CamPlume1 changed the title Feature/rulesets-> Not ready for review Feature/rulesets: End to End assignment creation (KHO-172, KHO-173) Dec 5, 2024
@@ -139,6 +139,15 @@ WHERE student_work_id = $3
return formatted[0], nil
}

// func (db *DB) GetWorkFromRepoName(ctx context.Context, repoName string) (*models.StudentWork, error){
// var studentWork models.StudentWork
// err := db.connPool.QueryRow(ctx, `SELECT * FROM student_works WHERE repo_name = $1`, repoName).Scan(&studentWork)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving-> This is functional but throws an error because it's unused. No reason to delete working code

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YAGNI.

Also, this is already implemented below in GetWorkByRepoName.

@@ -139,6 +139,15 @@ WHERE student_work_id = $3
return formatted[0], nil
}

// func (db *DB) GetWorkFromRepoName(ctx context.Context, repoName string) (*models.StudentWork, error){
// var studentWork models.StudentWork
// err := db.connPool.QueryRow(ctx, `SELECT * FROM student_works WHERE repo_name = $1`, repoName).Scan(&studentWork)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YAGNI.

Also, this is already implemented below in GetWorkByRepoName.


func CriticalGithubError() APIError {
return NewAPIError(http.StatusInternalServerError, fmt.Errorf("critical Out of State Error: Github Integration"))
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this different than GitHubAPI error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to have this one in the intermediary stage before I can properly implement the recovery process.

In my mind this is an error that should not be thrown in any case, and probably represents a panic state

.gitignore Show resolved Hide resolved
backend/internal/github/sharedclient/sharedclient.go Outdated Show resolved Hide resolved
// Retrieve assignment deadline from DB
deadline, err := s.store.GetAssignmentDueDateByRepoName(c.Context(), *pushEvent.Repo.Name)
if err == nil {
// There is a deadline
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a faulty way to look for a deadline. If another error happens, the code will mistakenly proceed.

IMO, you're better off defining a function GetAssignmentByBaseRepoName and handling the logic for whether there is/isn't a due date here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -31,6 +31,7 @@ type Works interface {
GetWorks(ctx context.Context, classroomID int, assignmentID int) ([]*models.StudentWorkWithContributors, error)
GetWork(ctx context.Context, classroomID int, assignmentID int, studentWorkID int) (*models.PaginatedStudentWorkWithContributors, error)
CreateStudentWork(ctx context.Context, assignmentOutlineID int32, gitHubUserID int64, repoName string, workState models.WorkState, dueDate *time.Time) (models.StudentWork, error)
GetAssignmentDueDateByRepoName(ctx context.Context, repoName string) (*time.Time, error)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is under the wrong type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -50,3 +52,15 @@ func (db *DB) GetAssignmentTemplateByID(ctx context.Context, templateID int64) (

return assignmentTemplate, nil
}

func (db *DB) GetAssignmentDueDateByRepoName(ctx context.Context, repoName string) (*time.Time, error){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above about generalizing this return Assignment object and doing field extraction in service layer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -1,6 +1,7 @@
package organizations

import (
//"fmt"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants