-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from ls1intum/develop
Develop
- Loading branch information
Showing
42 changed files
with
1,070 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/main/java/de/tum/cit/ase/domain/ScheduleSubscriber.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package de.tum.cit.ase.domain; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import jakarta.persistence.*; | ||
|
||
@Entity | ||
@Table(name = "schedule_subscriber") | ||
public class ScheduleSubscriber { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "schedule_id", nullable = false) | ||
@JsonIgnore | ||
private SimulationSchedule schedule; | ||
|
||
@Column(name = "email", nullable = false) | ||
private String email; | ||
|
||
@Column(name = "subscription_key", nullable = false, length = 20) | ||
private String key; | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
|
||
public SimulationSchedule getSchedule() { | ||
return schedule; | ||
} | ||
|
||
public void setSchedule(SimulationSchedule schedule) { | ||
this.schedule = schedule; | ||
} | ||
|
||
public String getEmail() { | ||
return email; | ||
} | ||
|
||
public void setEmail(String email) { | ||
this.email = email; | ||
} | ||
|
||
public String getKey() { | ||
return key; | ||
} | ||
|
||
public void setKey(String key) { | ||
this.key = key; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
src/main/java/de/tum/cit/ase/domain/SimulationResultForSummary.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package de.tum.cit.ase.domain; | ||
|
||
import de.tum.cit.ase.util.TimeLogUtil; | ||
|
||
public class SimulationResultForSummary { | ||
|
||
public String avgTotal; | ||
public String avgAuthentication; | ||
public String avgGetStudentExam; | ||
public String avgStartStudentExam; | ||
public String avgSubmitExercise; | ||
public String avgSubmitStudentExam; | ||
public String avgClone; | ||
public String avgPush; | ||
|
||
public static SimulationResultForSummary from(SimulationRun run) { | ||
SimulationResultForSummary result = new SimulationResultForSummary(); | ||
result.avgTotal = | ||
TimeLogUtil.formatDuration( | ||
run | ||
.getStats() | ||
.stream() | ||
.filter((SimulationStats stats) -> stats.getRequestType().equals(RequestType.TOTAL)) | ||
.findFirst() | ||
.orElseThrow() | ||
.getAvgResponseTime() | ||
); | ||
result.avgAuthentication = | ||
TimeLogUtil.formatDuration( | ||
run | ||
.getStats() | ||
.stream() | ||
.filter((SimulationStats stats) -> stats.getRequestType().equals(RequestType.AUTHENTICATION)) | ||
.findFirst() | ||
.orElseThrow() | ||
.getAvgResponseTime() | ||
); | ||
result.avgGetStudentExam = | ||
TimeLogUtil.formatDuration( | ||
run | ||
.getStats() | ||
.stream() | ||
.filter((SimulationStats stats) -> stats.getRequestType().equals(RequestType.GET_STUDENT_EXAM)) | ||
.findFirst() | ||
.orElseThrow() | ||
.getAvgResponseTime() | ||
); | ||
result.avgStartStudentExam = | ||
TimeLogUtil.formatDuration( | ||
run | ||
.getStats() | ||
.stream() | ||
.filter((SimulationStats stats) -> stats.getRequestType().equals(RequestType.START_STUDENT_EXAM)) | ||
.findFirst() | ||
.orElseThrow() | ||
.getAvgResponseTime() | ||
); | ||
result.avgSubmitExercise = | ||
TimeLogUtil.formatDuration( | ||
run | ||
.getStats() | ||
.stream() | ||
.filter((SimulationStats stats) -> stats.getRequestType().equals(RequestType.SUBMIT_EXERCISE)) | ||
.findFirst() | ||
.orElseThrow() | ||
.getAvgResponseTime() | ||
); | ||
result.avgSubmitStudentExam = | ||
TimeLogUtil.formatDuration( | ||
run | ||
.getStats() | ||
.stream() | ||
.filter((SimulationStats stats) -> stats.getRequestType().equals(RequestType.SUBMIT_STUDENT_EXAM)) | ||
.findFirst() | ||
.orElseThrow() | ||
.getAvgResponseTime() | ||
); | ||
result.avgClone = | ||
TimeLogUtil.formatDuration( | ||
run | ||
.getStats() | ||
.stream() | ||
.filter((SimulationStats stats) -> stats.getRequestType().equals(RequestType.CLONE)) | ||
.findFirst() | ||
.orElseThrow() | ||
.getAvgResponseTime() | ||
); | ||
result.avgPush = | ||
TimeLogUtil.formatDuration( | ||
run | ||
.getStats() | ||
.stream() | ||
.filter((SimulationStats stats) -> stats.getRequestType().equals(RequestType.PUSH)) | ||
.findFirst() | ||
.orElseThrow() | ||
.getAvgResponseTime() | ||
); | ||
return result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 9 additions & 1 deletion
10
src/main/java/de/tum/cit/ase/repository/LogMessageRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
package de.tum.cit.ase.repository; | ||
|
||
import de.tum.cit.ase.domain.LogMessage; | ||
import java.util.List; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
|
||
public interface LogMessageRepository extends JpaRepository<LogMessage, Long> {} | ||
@Repository | ||
public interface LogMessageRepository extends JpaRepository<LogMessage, Long> { | ||
@Query(value = "select log from LogMessage log where log.simulationRun.id = :#{#simulationRunId} and log.isError = true") | ||
List<LogMessage> findBySimulationRunIdAndErrorIsTrue(@Param("simulationRunId") long simulationRunId); | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/de/tum/cit/ase/repository/ScheduleSubscriberRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package de.tum.cit.ase.repository; | ||
|
||
import de.tum.cit.ase.domain.ScheduleSubscriber; | ||
import java.util.Optional; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface ScheduleSubscriberRepository extends JpaRepository<ScheduleSubscriber, Long> { | ||
@Query(value = "select subscriber from ScheduleSubscriber subscriber where subscriber.key = :#{#key}") | ||
Optional<ScheduleSubscriber> findByKey(@Param("key") String key); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.