generated from wessel/boilerplate
fix(exam_result_generator): Translate tentamen -> exam
This commit is contained in:
@@ -110,7 +110,7 @@ bool DatabaseManager::enroll_student_into_course(const StudentCourse& sc) {
|
||||
}
|
||||
}
|
||||
|
||||
bool DatabaseManager::store_tentamen_result(const std::string& student_name, const std::string& lecture_name, int grade) {
|
||||
bool DatabaseManager::store_exam_result(const std::string& student_name, const std::string& lecture_name, int grade) {
|
||||
if (!is_connected()) return false;
|
||||
|
||||
try {
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
|
||||
// Data operations
|
||||
std::vector<StudentCourse> queue_pending_combinations();
|
||||
bool store_tentamen_result(const std::string& student_name, const std::string& lecture_name, int grade);
|
||||
bool store_exam_result(const std::string& student_name, const std::string& lecture_name, int grade);
|
||||
bool enroll_student_into_course(const StudentCourse& sc);
|
||||
private:
|
||||
rclcpp::Logger logger_;
|
||||
|
||||
@@ -18,11 +18,11 @@ static const std::string SQL_CREATE_ENROLLMENTS_TABLE = R"(
|
||||
)";
|
||||
|
||||
static const std::string SQL_CREATE_EXAM_RESULTS = R"(
|
||||
CREATE TABLE IF NOT EXISTS tentamen_results (
|
||||
CREATE TABLE IF NOT EXISTS exam_results (
|
||||
id SERIAL PRIMARY KEY,
|
||||
student_name VARCHAR(100) NOT NULL,
|
||||
lecture_name VARCHAR(100) NOT NULL,
|
||||
tentamen_grade FLOAT NOT NULL,
|
||||
exam_grade FLOAT NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE(student_name, lecture_name)
|
||||
);
|
||||
@@ -50,10 +50,10 @@ static const std::string SQL_SELECT_MISSING_RESULTS = R"(
|
||||
)";
|
||||
|
||||
static const std::string SQL_INSERT_EXAM_RESULT = R"(
|
||||
INSERT INTO tentamen_results (student_name, lecture_name, tentamen_grade)
|
||||
INSERT INTO exam_results (student_name, lecture_name, exam_grade)
|
||||
VALUES ($1, $2, $3)
|
||||
ON CONFLICT (student_name, lecture_name)
|
||||
DO UPDATE SET tentamen_grade = EXCLUDED.tentamen_grade, created_at = CURRENT_TIMESTAMP
|
||||
DO UPDATE SET exam_grade = EXCLUDED.exam_grade, created_at = CURRENT_TIMESTAMP
|
||||
)";
|
||||
|
||||
static const std::string SQL_INSERT_STUDENT_ENROLLMENT = R"(
|
||||
|
||||
@@ -62,7 +62,7 @@ void ExamResultGenerator::generate_random_result() {
|
||||
|
||||
int grade = grade_dist_(gen_);
|
||||
|
||||
db_manager_->store_tentamen_result(selected.student_name, selected.lecture_name, grade);
|
||||
db_manager_->store_exam_result(selected.student_name, selected.lecture_name, grade);
|
||||
|
||||
// Publish exam result
|
||||
auto exam_msg = g2_2025_interfaces::msg::Exam();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* nodes/ExamResultGenerator.hpp
|
||||
* Exam result generator node for the first assignment of the course EE at InHolland.
|
||||
*
|
||||
* Collects student/course combinations from database where tentamen results need to be generated.
|
||||
* Collects student/course combinations from database where exam results need to be generated.
|
||||
* Randomly generates and broadcasts exam marks (10-100) every 2 seconds.
|
||||
* Can receive messages to add/remove student/course combinations.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user