def post(self): # create or update feature bet user = UserData.get_current_user() if not user.is_server_admin(): # make sure user has an account to create course self.redirect('/') feature_key = self.request.get('feature_wanted') feature = Feature.get_by_id(int(feature_key)) options = self.request.get('options').split('\n') start_time = self.request.get('start-time') start_time = datetime.datetime.strptime(start_time, "%Y-%m-%d") end_time = self.request.get('end-time') end_time = datetime.datetime.strptime(end_time, "%Y-%m-%d") billing_time = self.request.get('billing-time') billing_time = datetime.datetime.strptime(billing_time, "%Y-%m-%d") new_bet = FeatureBet(performance_bet=feature.performances[0], bet_options=options, start_time=start_time, end_time=end_time, billing_time=billing_time ) new_bet.put() self.redirect('/show-feature/%s' % feature.key.id()) #
def get(self, feature_id): user = UserData.get_current_user() feature = Feature.get_by_id(int(feature_id)) feature_KPIs = ','.join(feature.KPIs) feature_performance = feature.performances[0].get() feature_bets = FeatureBet.get_by_feature_performance(feature_performance) # get feature bets by feature # get user_feature bets by feature bets # get feature performance by feature # show all these data in the proper way data = { 'user': user, 'feature': feature, 'feature_KPIs': feature_KPIs, 'feature_bets': feature_bets, 'feature_performance': feature_performance } return self.render('feature/show-feature.html', data)