Esempio n. 1
0
    def _get_course_tile(self):
        """Get course title. In this module as should come from
		the lsr_fiscal_year table rather than the product_info
		table in case the course has registrations but has yet
		to be catalogued by CM."""
        field_name = 'course_title_{0}'.format(self.lang)
        table_name = 'lsr{0}'.format(self.fiscal_year)
        query = """
			SELECT {0}
			FROM {1}
			WHERE course_code = %s
			LIMIT 1;
		""".format(field_name, table_name)
        results = query_mysql(query, (self.course_code, ))
        results = as_string(results)
        self.course_title = results
Esempio n. 2
0
def _query_product_info(field, lang, course_code):
	field_name = field
	query = "SELECT {0} FROM product_info WHERE course_code = %s LIMIT 1;".format(field_name)
	result = query_mysql(query, (course_code,))
	return as_string(result, error_msg='<awaiting mapping>')
Esempio n. 3
0
def course_description(lang, course_code):
	field_name = 'course_description'
	query_description = "SELECT {0} FROM product_info WHERE course_code = %s LIMIT 1;".format(field_name)
	description = query_mysql(query_description, (course_code,))
	return as_string(description, error_msg='Apologies, this course is currently catalogued without a description.')
Esempio n. 4
0
def online_course(fiscal_year, course_code):
	table_name = 'lsr{0}'.format(fiscal_year)
	query = "SELECT business_type FROM {0} WHERE course_code = %s LIMIT 1;".format(table_name)
	business_type = query_mysql(query, (course_code,))
	business_type = as_string(business_type)
	return True if (business_type == 'Online') else False
Esempio n. 5
0
def course_title(lang, fiscal_year, course_code):
	field_name = 'course_title_{0}'.format(lang)
	table_name = 'lsr{0}'.format(fiscal_year)
	query = "SELECT {0} FROM {1} WHERE course_code = %s LIMIT 1;".format(field_name, table_name)
	course_title = query_mysql(query, (course_code,))
	return as_string(course_title, error_msg=False)