def app_ratings(version=DEFAULT_API_VERSION): if request.method == 'POST': return {'error': False} slug = request.form.get('app') or request.args.get('app') data = app._paginated('objects', review_generator) data['info'] = { 'slug': slug, 'average': random.random() * 4 + 1, } data.update(factory.review_user_data(slug)) if slug == 'has_rated': data['objects'][0]['is_author'] = True data['objects'][0]['is_flagged'] = False return data
def app_ratings(version=DEFAULT_API_VERSION): if request.method == 'POST': return {'error': False} slug = request.form.get('app') or request.args.get('app') if slug == 'unrated': return { 'info': { 'average': 0, 'slug': slug, }, 'meta': { 'next': None, 'prev': None, 'total_count': 0, }, 'objects': [], } data = app._paginated('objects', review_generator, slug=slug) data['info'] = { 'average': random.random() * 4 + 1, 'current_version': '2.0', 'slug': slug, } data.update(factory.review_user_data(slug)) if slug == 'has_rated': data['objects'][0]['has_flagged'] = False data['objects'][0]['is_author'] = True elif slug == 'old-reviews': for review in data['objects']: review['version'] = { 'version': '1.0' } return data
def app_ratings(version=DEFAULT_API_VERSION): if request.method == 'POST': return {'error': False} slug = request.form.get('app') or request.args.get('app') if slug == 'unrated': return { 'info': { 'average': 0, 'slug': slug, }, 'meta': { 'next': None, 'prev': None, 'total_count': 0, }, 'objects': [], } data = app._paginated('objects', review_generator, slug=slug) data['info'] = { 'average': random.random() * 4 + 1, 'current_version': '2.0', 'slug': slug, } data.update(factory.review_user_data(slug)) if slug == 'has_rated': data['objects'][0]['has_flagged'] = False data['objects'][0]['is_author'] = True elif slug == 'old-reviews': for review in data['objects']: review['version'] = {'version': '1.0'} return data