@ensure_csrf_cookie
@cache_control(no_cache=True, no_store=True, must_revalidate=True)
@require_level('staff')
def get_sale_order_records(request, course_id):
 course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)
 query_features = [('id', 'Order Id'), ('company_name', 'Company Name'), ('company_contact_name', 'Company Contact Name'), ('company_contact_email', 'Company Contact Email'), ('logged_in_username', 'Login Username'), ('logged_in_email', 'Login User Email'), ('purchase_time', 'Date of Sale'), ('customer_reference_number', 'Customer Reference Number'), ('recipient_name', 'Recipient Name'), ('recipient_email', 'Recipient Email'), ('bill_to_street1', 'Street 1'), ('bill_to_street2', 'Street 2'), ('bill_to_city', 'City'), ('bill_to_state', 'State'), ('bill_to_postalcode', 'Postal Code'), ('bill_to_country', 'Country'), ('order_type', 'Order Type'), ('status', 'Order Item Status'), ('coupon_code', 'Coupon Code'), ('list_price', 'List Price'), ('unit_cost', 'Unit Price'), ('quantity', 'Quantity'), ('total_discount', 'Total Discount'), ('total_amount', 'Total Amount Paid')]
 db_columns = [x[0] for x in query_features]
 csv_columns = [x[1] for x in query_features]
 sale_data = instructor_analytics.basic.sale_order_record_features(course_id, db_columns)
 (__, datarows) = instructor_analytics.csvs.format_dictlist(sale_data, db_columns)
 return instructor_analytics.csvs.create_csv_response('e-commerce_sale_order_records.csv', csv_columns, datarows)

@ ensure_csrf_cookie @ cache_control ( no_cache = True , no_store = True , must_revalidate = True ) @ require_level ( 'staff' ) def get_sale_order_records ( request , course_id ) : course_id = SlashSeparatedCourseKey . from_deprecated_string ( course_id ) query_features = [ ( 'id' , 'Order Id' ) , ( 'company_name' , 'Company Name' ) , ( 'company_contact_name' , 'Company Contact Name' ) , ( 'company_contact_email' , 'Company Contact Email' ) , ( 'logged_in_username' , 'Login Username' ) , ( 'logged_in_email' , 'Login User Email' ) , ( 'purchase_time' , 'Date of Sale' ) , ( 'customer_reference_number' , 'Customer Reference Number' ) , ( 'recipient_name' , 'Recipient Name' ) , ( 'recipient_email' , 'Recipient Email' ) , ( 'bill_to_street1' , 'Street 1' ) , ( 'bill_to_street2' , 'Street 2' ) , ( 'bill_to_city' , 'City' ) , ( 'bill_to_state' , 'State' ) , ( 'bill_to_postalcode' , 'Postal Code' ) , ( 'bill_to_country' , 'Country' ) , ( 'order_type' , 'Order Type' ) , ( 'status' , 'Order Item Status' ) , ( 'coupon_code' , 'Coupon Code' ) , ( 'list_price' , 'List Price' ) , ( 'unit_cost' , 'Unit Price' ) , ( 'quantity' , 'Quantity' ) , ( 'total_discount' , 'Total Discount' ) , ( 'total_amount' , 'Total Amount Paid' ) ] db_columns = [ x [ 0 ] for x in query_features ] csv_columns = [ x [ 1 ] for x in query_features ] sale_data = instructor_analytics . basic . sale_order_record_features ( course_id , db_columns ) ( __ , datarows ) = instructor_analytics . csvs . format_dictlist ( sale_data , db_columns ) return instructor_analytics . csvs . create_csv_response ( 'e-commerce_sale_order_records.csv' , csv_columns , datarows )
return the summary of all sales records for a particular course .