src/schoology-extractor/data_generation/discussions.py
def rollback_loaded_discussions(
    request_client: RequestClient, response_dict: Dict[str, List[Dict]]
):
    """
    Delete already loaded discussions via the Schoology API.
    **** Used during testing of the load functionality ****

    Parameters
    ----------
    request_client : RequestClient
        A RequestClient initialized for access to the Schoology API
    response_dict: Dict[str, List[Dict]]
        A Dict of mappings from Schoology section id to a list of JSON-like response objects
        from a successful discussion load operation
    """
    logger.info(
        "**** Rolling back discussions via Schoology API - for testing purposes"
    )
    for section_id, creation_response in response_dict.items():
        logger.info(
            "**** Deleting %s discussions for section %s",
            len(creation_response),
            section_id,
        )

        ids: List[str] = list(
            map(lambda discussion: str(discussion["id"]), creation_response)
        )

        for id in ids:
            request_client.delete(f"sections/{section_id}/discussions", id)
            logger.info("**** Deleted discussion with id %s", id)

        logger.info("**** Successfully deleted %s discussions", len(ids))

    Delete already loaded discussions via the Schoology API.
    **** Used during testing of the load functionality ****

    Parameters
    ----------
    request_client : RequestClient
        A RequestClient initialized for access to the Schoology API
    response_dict: Dict[str, List[Dict]]
        A Dict of mappings from Schoology section id to a list of JSON-like response objects
        from a successful discussion load operation
    
Delete already loaded discussions via the Schoology API.
Used during testing of the load functionality

Parameters

request_client : RequestClient
A RequestClient initialized for access to the Schoology API
response_dict: Dict[str, List[Dict]]
A Dict of mappings from Schoology section id to a list of JSON-like response objects
from a successful discussion load operation
Delete already loaded discussions via the Schoology API . Used during testing of the load functionality Parameters request_client : RequestClient A RequestClient initialized for access to the Schoology API response_dict : Dict [ str List [ Dict ]] A Dict of mappings from Schoology section id to a list of JSON - like response objects from a successful discussion load operation
def rollback_loaded_discussions(
    request_client: RequestClient, response_dict: Dict[str, List[Dict]]
):
    logger.info(
        "**** Rolling back discussions via Schoology API - for testing purposes"
    )
    for section_id, creation_response in response_dict.items():
        logger.info(
            "**** Deleting %s discussions for section %s",
            len(creation_response),
            section_id,
        )
        ids: List[str] = list(
            map(lambda discussion: str(discussion["id"]), creation_response)
        )
        for id in ids:
            request_client.delete(f"sections/{section_id}/discussions", id)
            logger.info("**** Deleted discussion with id %s", id)
        logger.info("**** Successfully deleted %s discussions", len(ids))
def rollback_loaded_discussions ( request_client : RequestClient , response_dict : Dict [ str , List [ Dict ] ] ) : logger . info ( "**** Rolling back discussions via Schoology API - for testing purposes" ) for section_id , creation_response in response_dict . items ( ) : logger . info ( "**** Deleting %s discussions for section %s" , len ( creation_response ) , section_id , ) ids : List [ str ] = list ( map ( lambda discussion : str ( discussion [ "id" ] ) , creation_response ) ) for id in ids : request_client . delete ( f"sections/{section_id}/discussions" , id ) logger . info ( "**** Deleted discussion with id %s" , id ) logger . info ( "**** Successfully deleted %s discussions" , len ( ids ) )
Delete already loaded discussions via the Schoology API.
Delete already loaded discussions via the Schoology API .
"""
    Delete already loaded discussions via the Schoology API.
    **** Used during testing of the load functionality ****

    Parameters
    ----------
    request_client : RequestClient
        A RequestClient initialized for access to the Schoology API
    response_dict: Dict[str, List[Dict]]
        A Dict of mappings from Schoology section id to a list of JSON-like response objects
        from a successful discussion load operation
    """
request_client
RequestClient
response_dict
Dict[str, List[Dict]]