artemis

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArtemisClient

type ArtemisClient struct {
	Username string

	HTTP *resty.Client
	WS   *sockjs.SockJSClient

	// Absolute path to the working directory
	WorkDir string
	// contains filtered or unexported fields
}

func NewArtemisClient

func NewArtemisClient(username, password, workdir string) (*ArtemisClient, error)

Create a new authenticated Artemis client

func (*ArtemisClient) Authenticate

func (c *ArtemisClient) Authenticate(req *AuthenticateRequest) error

Authenticate with Artemis and store the JWT in the client

func (*ArtemisClient) Close

func (c *ArtemisClient) Close()

Shutdown the Artemis client (mainly the websocket connection)

func (*ArtemisClient) GetExerciseDetails

func (c *ArtemisClient) GetExerciseDetails(exerciseID string) (*ExerciseDetails, error)

Get the details of an exercise on Artemis by its ID

func (*ArtemisClient) IsAuthenticated

func (c *ArtemisClient) IsAuthenticated() bool

Check if the client is authenticated

func (*ArtemisClient) NewTempDir

func (c *ArtemisClient) NewTempDir(create bool) (string, error)

Get the path to a new temporary directory and optionally create it

The directory containing this path is guaranteed to exist.

type AuthenticateRequest

type AuthenticateRequest struct {
	Username     string `json:"username"`
	Password     string `json:"password"`
	RemememberMe bool   `json:"rememberMe"`
}

type ExerciseDetails

type ExerciseDetails struct {
	Type                                   string    `json:"type"`
	ID                                     int       `json:"id"`
	Title                                  string    `json:"title"`
	ShortName                              string    `json:"shortName"`
	MaxPoints                              float64   `json:"maxPoints"`
	BonusPoints                            float64   `json:"bonusPoints"`
	AssessmentType                         string    `json:"assessmentType"`
	ReleaseDate                            time.Time `json:"releaseDate"`
	DueDate                                time.Time `json:"dueDate"`
	ExampleSolutionPublicationDate         time.Time `json:"exampleSolutionPublicationDate"`
	Difficulty                             string    `json:"difficulty"`
	Mode                                   string    `json:"mode"`
	AllowComplaintsForAutomaticAssessments bool      `json:"allowComplaintsForAutomaticAssessments"`
	AllowManualFeedbackRequests            bool      `json:"allowManualFeedbackRequests"`
	IncludedInOverallScore                 string    `json:"includedInOverallScore"`
	ProblemStatement                       string    `json:"problemStatement"`
	Categories                             []string  `json:"categories"`
	PresentationScoreEnabled               bool      `json:"presentationScoreEnabled"`
	SecondCorrectionEnabled                bool      `json:"secondCorrectionEnabled"`
	Course                                 struct {
		ID                                             int       `json:"id"`
		Title                                          string    `json:"title"`
		ShortName                                      string    `json:"shortName"`
		StudentGroupName                               string    `json:"studentGroupName"`
		TeachingAssistantGroupName                     string    `json:"teachingAssistantGroupName"`
		EditorGroupName                                string    `json:"editorGroupName"`
		InstructorGroupName                            string    `json:"instructorGroupName"`
		StartDate                                      time.Time `json:"startDate"`
		EndDate                                        time.Time `json:"endDate"`
		EnrollmentStartDate                            time.Time `json:"enrollmentStartDate"`
		EnrollmentEndDate                              time.Time `json:"enrollmentEndDate"`
		Semester                                       string    `json:"semester"`
		TestCourse                                     bool      `json:"testCourse"`
		DefaultProgrammingLanguage                     string    `json:"defaultProgrammingLanguage"`
		OnlineCourse                                   bool      `json:"onlineCourse"`
		CourseInformationSharingConfiguration          string    `json:"courseInformationSharingConfiguration"`
		CourseInformationSharingMessagingCodeOfConduct string    `json:"courseInformationSharingMessagingCodeOfConduct"`
		MaxComplaints                                  int       `json:"maxComplaints"`
		MaxTeamComplaints                              int       `json:"maxTeamComplaints"`
		MaxComplaintTimeDays                           int       `json:"maxComplaintTimeDays"`
		MaxRequestMoreFeedbackTimeDays                 int       `json:"maxRequestMoreFeedbackTimeDays"`
		MaxComplaintTextLimit                          int       `json:"maxComplaintTextLimit"`
		MaxComplaintResponseTextLimit                  int       `json:"maxComplaintResponseTextLimit"`
		EnrollmentEnabled                              bool      `json:"enrollmentEnabled"`
		UnenrollmentEnabled                            bool      `json:"unenrollmentEnabled"`
		AccuracyOfScores                               int       `json:"accuracyOfScores"`
		RestrictedAthenaModulesAccess                  bool      `json:"restrictedAthenaModulesAccess"`
		TimeZone                                       string    `json:"timeZone"`
		LearningPathsEnabled                           bool      `json:"learningPathsEnabled"`
		RequestMoreFeedbackEnabled                     bool      `json:"requestMoreFeedbackEnabled"`
		ComplaintsEnabled                              bool      `json:"complaintsEnabled"`
	} `json:"course"`
	StudentParticipations []struct {
		Type                string    `json:"type"`
		ID                  int       `json:"id"`
		InitializationState string    `json:"initializationState"`
		InitializationDate  time.Time `json:"initializationDate"`
		TestRun             bool      `json:"testRun"`
		Results             []struct {
			ID             int       `json:"id"`
			CompletionDate time.Time `json:"completionDate"`
			Successful     bool      `json:"successful"`
			Score          float64   `json:"score"`
			Rated          bool      `json:"rated"`
			Submission     struct {
				SubmissionExerciseType string    `json:"submissionExerciseType"`
				ID                     int       `json:"id"`
				Submitted              bool      `json:"submitted"`
				Type                   string    `json:"type"`
				SubmissionDate         time.Time `json:"submissionDate"`
				CommitHash             string    `json:"commitHash"`
				BuildFailed            bool      `json:"buildFailed"`
				BuildArtifact          bool      `json:"buildArtifact"`
				Empty                  bool      `json:"empty"`
				DurationInMinutes      int       `json:"durationInMinutes"`
			} `json:"submission"`
			AssessmentType      string `json:"assessmentType"`
			TestCaseCount       int    `json:"testCaseCount"`
			PassedTestCaseCount int    `json:"passedTestCaseCount"`
			CodeIssueCount      int    `json:"codeIssueCount"`
		} `json:"results"`
		Submissions []struct {
			SubmissionExerciseType string    `json:"submissionExerciseType"`
			ID                     int       `json:"id"`
			Submitted              bool      `json:"submitted"`
			Type                   string    `json:"type"`
			SubmissionDate         time.Time `json:"submissionDate"`
			CommitHash             string    `json:"commitHash"`
			BuildFailed            bool      `json:"buildFailed"`
			BuildArtifact          bool      `json:"buildArtifact"`
			Empty                  bool      `json:"empty"`
			DurationInMinutes      int       `json:"durationInMinutes"`
		} `json:"submissions"`
		Student struct {
			ID                    int       `json:"id"`
			CreatedDate           time.Time `json:"createdDate"`
			Login                 string    `json:"login"`
			FirstName             string    `json:"firstName"`
			LastName              string    `json:"lastName"`
			Email                 string    `json:"email"`
			Activated             bool      `json:"activated"`
			LangKey               string    `json:"langKey"`
			LastNotificationRead  time.Time `json:"lastNotificationRead"`
			Internal              bool      `json:"internal"`
			Name                  string    `json:"name"`
			ParticipantIdentifier string    `json:"participantIdentifier"`
			Deleted               bool      `json:"deleted"`
		} `json:"student"`
		RepositoryURI                string `json:"repositoryUri"`
		BuildPlanID                  string `json:"buildPlanId"`
		Branch                       string `json:"branch"`
		Locked                       bool   `json:"locked"`
		UserIndependentRepositoryURI string `json:"userIndependentRepositoryUri"`
		ParticipantIdentifier        string `json:"participantIdentifier"`
		ParticipantName              string `json:"participantName"`
	} `json:"studentParticipations"`
	AllowOnlineEditor               bool   `json:"allowOnlineEditor"`
	AllowOfflineIde                 bool   `json:"allowOfflineIde"`
	StaticCodeAnalysisEnabled       bool   `json:"staticCodeAnalysisEnabled"`
	ProgrammingLanguage             string `json:"programmingLanguage"`
	SequentialTestRuns              bool   `json:"sequentialTestRuns"`
	ShowTestNamesToStudents         bool   `json:"showTestNamesToStudents"`
	TestCasesChanged                bool   `json:"testCasesChanged"`
	ProjectKey                      string `json:"projectKey"`
	ProjectType                     string `json:"projectType"`
	TestwiseCoverageEnabled         bool   `json:"testwiseCoverageEnabled"`
	ReleaseTestsWithExampleSolution bool   `json:"releaseTestsWithExampleSolution"`
	CheckoutSolutionRepository      bool   `json:"checkoutSolutionRepository"`
	ExerciseType                    string `json:"exerciseType"`
	StudentAssignedTeamIDComputed   bool   `json:"studentAssignedTeamIdComputed"`
	GradingInstructionFeedbackUsed  bool   `json:"gradingInstructionFeedbackUsed"`
	TeamMode                        bool   `json:"teamMode"`
	VisibleToStudents               bool   `json:"visibleToStudents"`
}

func (*ExerciseDetails) GetMostRecentScore

func (d *ExerciseDetails) GetMostRecentScore() int

type Task

type Task struct {
	CourseID          string
	TaskID            string
	CurrentPercentage int
	DesiredPercentage int
	GitConfig         *git.GitConfig
	// contains filtered or unexported fields
}

func NewRetriggerTask

func NewRetriggerTask(
	client *ArtemisClient,
	courseID, taskID string,
	gitCredentials *git.GitCredentials,
	desiredPercentage int,
) (*Task, error)

func (*Task) Cleanup

func (t *Task) Cleanup() error

Cleanup the task

func (*Task) Resolve

func (t *Task) Resolve() error

Populate the task with the necessary information for working with the Artemis API

Normally this should have already been done by the constructor.

func (*Task) Retrigger

func (t *Task) Retrigger() (string, error)

Retrigger the task to update the percentage and return the commit hash

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL