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

added expected column in ratings table #69

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/Database.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class Database {
this->ratings = factory.create("ratings", {
"predictionId INTEGER NOT NULL",
"rating INTEGER NOT NULL",
"expected BOOLEAN NOT NULL",
"FOREIGN KEY(predictionId) REFERENCES predictions(id)"
});

Expand Down
2 changes: 1 addition & 1 deletion include/Routes/Tests.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Tests : public Route {
auto uid = user_id_from_token(token);
if (authedUsers[uid] == token) {
auto pid = body["id"].get<string>();
db->ratings->add({"predictionId", "rating"}, {pid, body["rating"].get<string>()});
db->ratings->add({"predictionId", "rating", "expected"}, {pid, body["rating"].get<string>(), body["expected"].get<string>()});
respond(&response, string("Successfully rated prediction!"));
} else {
respond(&response, string("Error, user is not authorized!", 403));
Expand Down
Loading