Work on abstracts
This commit is contained in:
@@ -140,7 +140,7 @@ def sql_insert(
|
||||
if key != 'id': # Creating a special exception for the id field.
|
||||
field_list.append('`'+str(key) + '` = :' + str(key))
|
||||
|
||||
if isinstance(value, dict):
|
||||
if isinstance(value, dict) or isinstance(value, list):
|
||||
data[key] = json.dumps(value)
|
||||
|
||||
set_values_string = ', '.join(field_list)
|
||||
@@ -266,7 +266,7 @@ def sql_update(
|
||||
if key != 'id': # Creating a special exception for the id field.
|
||||
fields_string.append('`'+str(key) + '` = :' + str(key))
|
||||
|
||||
if isinstance(value, dict):
|
||||
if isinstance(value, dict) or isinstance(value, list):
|
||||
data[key] = json.dumps(value)
|
||||
|
||||
sql_set = ', '.join(fields_string)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import datetime
|
||||
import datetime, json
|
||||
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
from pydantic import BaseModel, EmailStr, Field, PrivateAttr, ValidationError, validator
|
||||
@@ -259,6 +259,13 @@ def create_update_event_abstract_obj(
|
||||
|
||||
event_abstract_dict = event_abstract_obj.dict(by_alias=False, exclude_defaults=False, exclude_unset=True, exclude={'event_file_list', 'event_person', 'event_person_list', 'event_presenter_list', 'created_on', 'updated_on'})
|
||||
|
||||
# log.debug(type(event_abstract_dict.get('topics_json', None)))
|
||||
# if 'topics_json' in event_abstract_dict and (isinstance(event_abstract_dict['topics_json'], dict) or isinstance(event_abstract_dict['topics_json'], list)):
|
||||
# log.debug('Need to convert to JSON string')
|
||||
# event_abstract_dict['topics_json'] = json.dumps(event_abstract_dict['topics_json'])
|
||||
# log.debug(event_abstract_dict)
|
||||
|
||||
|
||||
if event_abstract_id:
|
||||
if event_abstract_dict_up_result := sql_update(data=event_abstract_dict, table_name='event_abstract', rm_id_random=True):
|
||||
log.info(f'Event Abstract updated. event_abstract_id={event_abstract_id}')
|
||||
|
||||
@@ -180,13 +180,26 @@ class Event_Abstract_Base_New(Core_Std_Obj_Base):
|
||||
# poc_event_person_id_random: Optional[str] # Maybe change this to primary_event_person?
|
||||
|
||||
external_id: Optional[str]
|
||||
grant_id: Optional[str]
|
||||
|
||||
# type_code: Optional[str]
|
||||
|
||||
description: Optional[str]
|
||||
abstract: Optional[str]
|
||||
abstract: Optional[str] # Actual abstract text
|
||||
|
||||
passcode: Optional[str]
|
||||
|
||||
grant_code: Optional[str]
|
||||
grant_type_code: Optional[str]
|
||||
grant_json: Optional[Union[Json, None]]
|
||||
|
||||
category_code: Optional[str]
|
||||
# category2_code: Optional[str]
|
||||
|
||||
topics_json: Optional[Union[Json, None]]
|
||||
|
||||
submitter_json: Optional[Union[Json, None]]
|
||||
coauthors_json: Optional[Union[Json, None]]
|
||||
|
||||
class Config:
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
@@ -210,6 +223,8 @@ class Event_Abstract_In(Event_Abstract_Base_New):
|
||||
|
||||
event_session_id: Optional[int]
|
||||
|
||||
# grant_json: Optional[Union[str, None]]
|
||||
|
||||
|
||||
@validator('id', always=True)
|
||||
def event_abstract_id_lookup(cls, v, values, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user