src/schoology-extractor/data_generation/discussion_comments.py
def rollback_loaded_discussion_comments(
    request_client: RequestClient, response_dict: Dict[str, Dict[str, List[Dict]]]
):
    """
    Delete already loaded discussion comments 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, Dict[str, List[Dict]]]
        A Dict of mappings from Schoology section id to a dict of mappings
        of discussion ids to a list of JSON-like response objects
        from a successful discussion comment load operation
    """
    logger.info(
        "**** Rolling back discussion_comments via Schoology API - for testing purposes"
    )
    for section_id, discussions in response_dict.items():
        logger.info(
            "**** Deleting discussion comments for section %s",
            section_id,
        )
        for discussion_id, discussion_comments in discussions.items():
            logger.info(
                "****** Deleting discussion comments for discussion %s",
                discussion_id,
            )
            ids: List[str] = list(
                map(
                    lambda discussion_comment: str(discussion_comment["id"]),
                    discussion_comments,
                )
            )

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

    Delete already loaded discussion comments 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, Dict[str, List[Dict]]]
        A Dict of mappings from Schoology section id to a dict of mappings
        of discussion ids to a list of JSON-like response objects
        from a successful discussion comment load operation
    
Delete already loaded discussion comments via the Schoology API.
Used during testing of the load functionality

Parameters

RequestClient
A RequestClient initialized for access to the Schoology API
response_dict: Dict[str, Dict[str, List[Dict]]]
A Dict of mappings from Schoology section id to a dict of mappings
of discussion ids to a list of JSON-like response objects
from a successful discussion comment load operation
Delete already loaded discussion comments via the Schoology API . Used during testing of the load functionality Parameters RequestClient A RequestClient initialized for access to the Schoology API response_dict : Dict [ str Dict [ str List [ Dict ]]] A Dict of mappings from Schoology section id to a dict of mappings of discussion ids to a list of JSON - like response objects from a successful discussion comment load operation
def rollback_loaded_discussion_comments(
    request_client: RequestClient, response_dict: Dict[str, Dict[str, List[Dict]]]
):
    logger.info(
        "**** Rolling back discussion_comments via Schoology API - for testing purposes"
    )
    for section_id, discussions in response_dict.items():
        logger.info(
            "**** Deleting discussion comments for section %s",
            section_id,
        )
        for discussion_id, discussion_comments in discussions.items():
            logger.info(
                "****** Deleting discussion comments for discussion %s",
                discussion_id,
            )
            ids: List[str] = list(
                map(
                    lambda discussion_comment: str(discussion_comment["id"]),
                    discussion_comments,
                )
            )
            for id in ids:
                request_client.delete(
                    f"sections/{section_id}/discussions/{discussion_id}/comments", id
                )
                logger.info("******** Deleted discussion_comment with id %s", id)
def rollback_loaded_discussion_comments ( request_client : RequestClient , response_dict : Dict [ str , Dict [ str , List [ Dict ] ] ] ) : logger . info ( "**** Rolling back discussion_comments via Schoology API - for testing purposes" ) for section_id , discussions in response_dict . items ( ) : logger . info ( "**** Deleting discussion comments for section %s" , section_id , ) for discussion_id , discussion_comments in discussions . items ( ) : logger . info ( "****** Deleting discussion comments for discussion %s" , discussion_id , ) ids : List [ str ] = list ( map ( lambda discussion_comment : str ( discussion_comment [ "id" ] ) , discussion_comments , ) ) for id in ids : request_client . delete ( f"sections/{section_id}/discussions/{discussion_id}/comments" , id ) logger . info ( "******** Deleted discussion_comment with id %s" , id )
Delete already loaded discussion comments via the Schoology API.
Delete already loaded discussion comments via the Schoology API .
"""
    Delete already loaded discussion comments 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, Dict[str, List[Dict]]]
        A Dict of mappings from Schoology section id to a dict of mappings
        of discussion ids to a list of JSON-like response objects
        from a successful discussion comment load operation
    """
request_client
RequestClient
response_dict
Dict[str, Dict[str, List[Dict]]]