1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-21 00:45:18 +00:00

Can create new choices for a survey

This commit is contained in:
2020-07-10 11:59:18 +02:00
parent b76e16294a
commit 715cfb0716
4 changed files with 41 additions and 0 deletions

View File

@ -127,6 +127,14 @@ pub fn send_response(user_id: &UserID, survey_id: u64, choice_id: u64) -> Result
.insert_drop_result()
}
/// Block new survey choices from being created
pub fn block_new_choices_creation(survey_id: u64) -> ResultBoxError {
database::UpdateInfo::new(SURVEY_INFO_TABLE)
.cond_u64("ID", survey_id)
.set_legacy_bool("allow_new_choices", false)
.exec()
}
/// Turn a database entry into a row object
fn db_to_survey(row: &database::RowResult) -> ResultBoxError<Survey> {
let survey_id = row.get_u64("ID")?;