Skip to content
Snippets Groups Projects
Select Git revision
  • testing
  • production
  • integration
3 results

renderer.php

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    main.py 948 B
    import sys
    from datetime import datetime, timezone
    
    from requests import HTTPError
    
    from utils import get_existing_results, save_results
    
    
    def main(analytics_token):
        try:
            # Get existing results
            existing_results = get_existing_results(analytics_token)
    
            h5p_result = existing_results["count_h5p_statements"]
            moodle_result = existing_results["count_moodle_statements"]
    
            print(h5p_result, moodle_result)
    
            # Built results array
            results = [
                {
                    "column1": "h5p",
                    "column2": h5p_result["result"][0]["column2"],
                },
                {"column1": "moodle", "column2": moodle_result["result"][0]["column2"]},
            ]
    
            # Send result to rights engine
            save_results(analytics_token, results)
        except HTTPError as error:
            print(error.response.status_code, error.response.text)
    
    
    if __name__ == "__main__":
        main(sys.argv[1])