def vote_next(request): ip = request.META.get('REMOTE_ADDR') try: vote = Vote.objects.get(ip=ip) except Vote.DoesNotExist: try: reverse = socket.gethostbyaddr(ip)[0] except socket.herror: reverse = u'unknown <%s>' % ip vote = Vote(ip=ip, reverse=reverse) vote.point = 1 vote.save() # test votes = Vote.objects.all() points = sum(vote.point for vote in votes) if settings.MODE == 'static' and points >= settings.STATIC_THRESHOLD: spotify_next() elif settings.MODE == 'dynamic': clients = Client.objects.filter(up=True).count() if points >= clients // 2: spotify_next() else: messages.add_message(request, messages.SUCCESS, 'You have successfully voted.') else: messages.add_message(request, messages.SUCCESS, 'You have successfully voted.') return redirect('app.views.index')
def run(self): with data_session_scope() as session: for reward in MiningReward.mined_last_24h(session): self.parent().last_24_h_mine_count[ reward.address] = reward.count for reward in MiningReward.last_mined(session): self.parent().last_mined[reward.address] = reward.last_mined for vote in Vote.voted_last_24h(session): self.parent().last_24_h_vote_count[ vote.from_address] = vote.count for vote in Vote.last_voted(session): self.parent().last_voted[vote.from_address] = vote.last_voted for pending_vote in PendingVote.num_revokes( session, self.parent()._perm_type): self.parent().count_revokes[ pending_vote.address_to] = pending_vote.count self.parent().num_guardians = Permission.num_guardians(session) if self.parent()._perm_type == enums.MINE: self.parent()._data = list(Permission.validators(session)) elif self.parent()._perm_type == enums.ADMIN: self.parent()._data = list(Permission.guardians(session)) self.parent()._alias_list = Alias.get_aliases(session) self.parent().already_revoked = PendingVote.already_revoked( session, self.parent()._perm_type)
def add_vote(): req = request.get_json(force=True) user_id = req.get('user_id', None) game_id = req.get('game_id', None) team_id = req.get('team_id', None) if current_user().id != user_id: abort(403) game = Game.query.get(game_id) if not game: return bad_request('Game not found') team = Team.query.get(team_id) if not team: return bad_request('Team not found') if game.home_team != team and game.away_team != team: return bad_request('Team not playing in game') vote = Vote.query.filter_by(user_id=user_id, game_id=game_id).first() if not vote: vote = Vote(user_id=user_id, game_id=game_id, team_id=team_id) db.session.add(vote) db.session.commit() elif vote.team != team: vote.team = team db.session.commit() vote_schema = VoteSchema() output = vote_schema.dump(vote).data return jsonify({'vote': output})
def addVotes(self, ideas): votes = [] for i in range(20): vote = Vote() vote.value = random.choice([-1, 1]) vote.idea_id = ideas[randint(0, 14)].id self.addModel(vote) votes.append(vote) return votes
def vote(voteForm, user): clean = voteForm.cleaned_data idea = Idea.objects.get(id = clean['idea']) try: vote= Vote.objects.get(user = user, idea = idea) except: vote = Vote(vote = clean['vote'], user = user, idea = idea) vote.save() else: vote.delete()
def test_count_vote(self): """test counting votes for a post also test""" u1, u2 = self.test_create_users() p = self.test_create_post() choices = Choice.get_choices_by_post_id(p.post_id) c1, c2 = [choice.choice_id for choice in choices][0], [choice.choice_id for choice in choices][1] v1 = Vote.create(user_id=u1.user_id, choice_id=c1) v2 = Vote.create(user_id=u2.user_id, choice_id=c2) vote_dict, total_votes, doughnut_chart_dict = p.count_votes() self.assertEqual(total_votes, 2) self.assertEqual({c1:1, c2:1}, vote_dict)
def pitch_vote(id): pitch = Pitch.query.get(id) vote = Vote.query.filter_by(user_id=current_user.id, pitch_id=pitch.id).first() print(vote) if not vote: vote = Vote(type=vote, pitch_id=id) form = VoteForm() if form.validate_on_submit(): vote.type = form.type.data vote.save_vote() return redirect(url_for('.single_pitch', id=pitch.id))
def setUp(self): ''' Set up method that will run before every Test ''' # self.group_pick_up = Group( name="Excuse lines" ) # self.user_jim = User(username = "******", password = "******", email = "*****@*****.**" ) # self.new_line = Line( line_content="I am Groot", group = self.group_pick_up, user=self.user_jim) self.new_vote = Vote(vote_number=0)
def test_vote_constraints(self): first_vote = Vote() first_vote.idea_id = 1 first_vote.user_id = 1 first_vote.value = 1 second_vote = Vote() second_vote.idea_id = 1 second_vote.user_id = 1 second_vote.value = -1 self.addModel(first_vote) with self.assertRaises(IntegrityError): self.addModel(second_vote)
def test_get_all_votes(self): self.addTestModels() user = User() user.username = '******' user.email = '*****@*****.**' self.addModel(user) vote = Vote() vote.value = 1 vote.user_id = user.id vote.email = self.testIdea.id self.addModel(vote) self.assertCountEqual([vote, self.testVote], get_all_votes())
def init_votes(): queried_users = db.session.query(User).filter(User.name.in_(users)).all() queried_ideas = db.session.query(Idea).all() print('creating votes and events for users.') for user in queried_users: for idea in queried_ideas: if random.choice([True, False]): vote = Vote() vote.value = random.choice([-1, 1]) vote.idea_id = idea.id vote.user_id = user.id db.session.add(vote) db.session.commit() init_event(vote)
def deploy(): from app import db from app.models import User, Role, Question, Answer, Comment, Vote # db.drop_all() # db.create_all() # db.session.commit() Role.insert_roles() # #User.generate_fake() # User.add_self_follows() Question.generate_fake() Answer.generate_fake() # Comment.generate_fake() Vote.generate_fake()
def get(self, author): """Show votes logged in user has optionally filtered by author""" user = self.get_logged_in_user() if user is None: return self.render_template('error.html', msg="Must be logged in") if author != "": tweets = VoteModel.get_votes_by_author(user, author) return self.render_template('vote.html', user_name=user.user_name, tweets=tweets) votes = VoteModel.aggregate_votes_by_author(user, author) self.render_template('myvotes.html', user_name=user.user_name, votes=votes)
def test_create_vote(self): """test the creation of votes and check if it's correctly linked to post""" u1, u2 = self.test_create_users() p = self.test_create_post() choices = Choice.get_choices_by_post_id(p.post_id) c1, c2 = [choice.choice_id for choice in choices][0], [choice.choice_id for choice in choices][1] v1 = Vote.create(user_id=u1.user_id, choice_id=c1) v2 = Vote.create(user_id=u2.user_id, choice_id=c2) self.assertEqual(v1.user_id, u1.user_id) self.assertEqual(v2.choice_id, c2) self.assertIn(u1, p.get_voters()) self.assertIn(u2, p.get_voters()) self.assertEqual([u1, u2], p.get_voters()) self.assertEqual(Vote.get_vote_by_post_and_user_id(p.post_id, u1.user_id), c1) self.assertNotEqual(Vote.get_vote_by_post_and_user_id(p.post_id, u1.user_id), c2)
def create_vote(set_id): # upvote from body isUpvote = request.json['isUpvote'] # gets decodes userinfo out of token using auth0 api token = request.headers.get('Authorization') req = requests.get('https://codelet-app.auth0.com/userinfo', headers={'Authorization': token}).content userInfo = json.loads(req) userId = User.query.filter_by(email=userInfo['email']).first().id dbVote = Vote.query.filter_by(user_id=userId, set_id=set_id).first() if dbVote: if isUpvote == dbVote.is_upvote: db.session.delete(dbVote) db.session.commit() return "Deleted", 204 else: dbVote.is_upvote = not dbVote.is_upvote db.session.commit() return "Switched Vote", 206 else: new_vote = Vote(user_id=userId, set_id=set_id, is_upvote=isUpvote) db.session.add(new_vote) db.session.commit() return "Created vote", 201
def room(room_name): if not server_data.get_room(room_name).is_user_in_room(current_user.id): server_data.get_room(room_name).add_user(current_user.id) all_songs = get_all_songs_before_and_including(12) form = [] #[len(all_songs)] # dunno if I need all this but eh voted_for = [None] * len(all_songs) for i, song in enumerate(all_songs): form.append(VoteForm(prefix=song.country)) if form[i].validate_on_submit(): vote = Vote(form[i].vote.data, song.id, current_user.id) print("Adding vote for", song.name, " (id) ", song.id, " for user ", current_user.username, " with value ", form[i].vote.data) db.session.add(vote) #pylint: disable=E1101 db.session.commit() #pylint: disable=E1101 if has_voted_for_song(song.id, current_user.id): voted_for[i] = True else: voted_for[i] = False return render_template('room.html', room_name=room_name, title=room_name, form=form, songs=all_songs, voted_for=voted_for)
def vote_store_channel(sid): store = Store.read(sid) if store: request_data = request.form cid = request_data.get('cid', None) if not cid: return Response(status=400) else: cid = int(cid) idx = -1 for i, vote in enumerate(store.votes): if vote.cid == cid: idx = i break if idx >= 0: store.votes[idx].vote_count += 1 else: channel = Channel.read(cid) vote = Vote(sid=sid, cid=cid, vote_count=1) if channel: store.votes.append(vote) success = store.update() if success: result = store_schema.dump(store) return jsonify(result.data), 200 else: return Response(status=500) return Response(status=404)
def iusethis(request, host_id): h = get_object_or_404(Hosting, id=host_id) h.num_of_users = h.num_of_users + 1 h.save() Vote(hosting_id=host_id, ip=get_client_ip(request)).save() messages.add_message(request, messages.INFO, 'Thank you.Your vote is counted !') return HttpResponseRedirect('/')
def kill_in_threads(role, threads): """ Removes any activity of that given role from the thread. Used when a role is killed before their action is resolved """ for t in threads: votes = Vote.all().filter('actor', role).filter('thread', t).order('-created') if votes and votes.count(): votes[0].decrement()
def vote_keep(request): ip = request.META.get('REMOTE_ADDR') try: vote = Vote.objects.get(ip=ip) except Vote.DoesNotExist: try: reverse = socket.gethostbyaddr(ip)[0] except socket.herror: reverse = u'unknown <%s>' % ip vote = Vote(ip=ip, reverse=reverse) vote.point = -1 vote.save() messages.add_message(request, messages.SUCCESS, 'You have successfully voted.') return redirect('app.views.index')
def vote(): form = request.form user_id = form['user_id'] phone_id = form['phone_id'] new_vote = Vote(user_id=user_id, phone_id=phone_id) db.session.add(new_vote) db.session.commit() flash('Congratulations on voting success', 'yes') return jsonify({'code': '200'})
def vote(p_thing=None): if request.method == "GET": votes = {} thing = Thing.query.filter(Thing.name.ilike(p_thing)).first() if not thing: return f"no thing '{p_thing}'", 404 for vote in Vote.query.filter(Vote.thing_id == thing.id).all(): votes[vote.id] = { "thing_id": vote.thing_id, "user_id": vote.user_id, "vote_love": vote.vote_love, "vote_hobby": vote.vote_hobby, "timestamp": vote.timestamp, } return votes if request.method == "POST": user_id = session.get("user_id") if user_id: user = User.query.get(user_id) if not user: return "no user", 400 else: return "no user", 400 thing = Thing.query.filter(Thing.name.ilike(p_thing)).first() if not thing: return f"no thing '{p_thing}'", 400 vote_love = int(request.form.get("vote_love")) vote_hobby = int(request.form.get("vote_hobby")) thing_id = thing.id timestamp = datetime.utcnow() if vote_love not in [0, 1]: return f"vote_love cannot be {vote_love}", 400 if vote_hobby not in [0, 1]: return f"vote_hobby cannot be {vote_hobby}", 400 if vote_love == 0 and vote_hobby == 1: return f"no hobby if you do not love it, ok?!", 400 v = Vote.query.filter( Vote.thing_id == thing_id, Vote.user_id == user_id ).first() if not v: v = Vote() v.user_id = user_id v.thing_id = thing_id v.vote_love = vote_love v.vote_hobby = vote_hobby v.timestamp = timestamp db.session.add(v) db.session.commit() return "succesful"
def test_vote(self): user1 = User(username='******', email='*****@*****.**') team1 = Team(name='Yankees', city='New York', abbreviation='NYY') team2 = Team(name='Cubs', city='Chicago', abbreviation='CHC') game1 = Game(schedule_status='normal', delayed_or_postponed_reason=None, location='Yankee Stadium', home_team=team1, away_team=team2) db.session.add_all([user1, team1, team2, game1]) db.session.commit() # User vote method user1.vote_for_team(game1, team2) self.assertEqual(team2.total_votes, 1) # Vote class method to create new vote Vote.place_vote(user1, game1, team2) self.assertEqual(team2.total_votes, 2)
def test_check_vote_event(self): self.addModel(self.testUser) self.testIdea.user_id = self.testUser.id self.addModel(self.testIdea) for i in range(10): user = User() user.username = str(i) user.email = '{}@mail.com'.format(i) self.addModel(user) vote = Vote() vote.idea_id = self.testIdea.id vote.user_id = user.id vote.value = 1 self.addModel(vote) check_vote_event(vote) if i == 5: self.assertEqual(EventType.upvotes, Event.query.first().type) elif i == 10: self.assertEqual(EventType.votes, Event.query.first().type)
def vote(winner_id, loser_id, vote_key): if vote_key == session.get('vote_key'): v = Vote(winner_id=winner_id, loser_id=loser_id) db.session.add(v) winner = User.query.filter_by(id=winner_id).first() loser = User.query.filter_by(id=loser_id).first() winner.rating, loser.rating = update_ratings(winner.rating, loser.rating) db.session.commit() return redirect('/')
def read(self, request, idea_id, user_id, vote_value, apikey, apisignature): print vote_value """ POST a vote """ base = Vote.objects try: user = User.objects.get(id=user_id) idea = Idea.objects.get(id=idea_id) except: return {'error':'idea or user not found'} else: try: #check if the vote already exists vote = Vote.objects.get(user = user, idea = idea) except: vote = Vote(vote = vote_value, user = user, idea = idea) vote.save() return {'success':'true'} else: vote.delete() return {'success':'false'}
def upvote(post_id): post_to_upvote = Post.query.filter_by(id=post_id).first_or_404() vote_query = Vote.query.filter_by(user_id=current_user.id, post_id=post_to_upvote.id).first() if vote_query is not None: flash("You already voted in this post.") else: post_to_upvote.update_votes() vote = Vote(user_id=current_user.id, post_id=post_to_upvote.id) db.session.add(vote) db.session.commit() return redirect(redirect_url())
def test_num_vote(self): ''' Test to check if up_vote is working ''' # self.group_pick_up = Group( name="Excuse lines" ) # self.user_jim = User(username = "******", password = "******", email = "*****@*****.**" ) # self.new_line = Line( line_content="I am Groot", group = self.group_pick_up, user=self.user_jim) self.new_vote.save_vote() gotten_votes = Vote.num_vote(123412312351123412341234123412341234) self.assertEqual(gotten_votes, 0)
def test_get_votes(self): ''' Test case to check if a line and its information is returned by the get_lines function that takes in an id and match it to id in the group table ''' # Line.query.delete() # User.query.delete() # Group.query.delete() self.new_vote.save_vote() gotten_votes = Vote.get_votes(4990826417581240726341234,41872308461293846123987412893471) self.assertFalse( len(gotten_votes) , 1)
def vote(self, tweet_id, count): """Process a vote 'up' for given user_name on given tweet""" tweet_info = self.get_tweet_info(tweet_id) if tweet_info is None: raise Exception # FIXME: Handle error in AJAX request? user = self.get_logged_in_user() if user is None: return None tweet = Tweet.get_or_create(tweet_info) return VoteModel.get_or_create(user, tweet, count)
def upvote(post_id, current_user): post_to_upvote = Post.query.filter_by( company_id=current_user.company_id, deleted=0, id=post_id).first_or_404() vote_query = Vote.query.filter_by(user_id=current_user.id, post_id=post_to_upvote.id).first() if vote_query is not None: return False else: post_to_upvote.update_votes() vote = Vote(user_id=current_user.id, post_id=post_to_upvote.id) db.session.add(vote) db.session.commit() return True
def make_vote(flag, mid): """ makes a vote record in the database, flag indicates wheather up or down""" record = Vote.query.filter_by(user_id=current_user.id, post_id=mid).first() if record: return jsonify({ "id": mid, "flag": flag, "msg": "already exists!", "ratio": getVotingRatio(mid) }) vote = Vote(user_id=current_user.id, post_id=mid, is_pro=(int(flag) & 1)) db.session.add(vote) db.session.commit() return jsonify({"ratio": getVotingRatio(mid)})
def vote(): if not current_user.is_authenticated: return redirect(url_for('login')) queried_idea = get_idea(request.form.get('target')) if queried_idea is None: abort(409) if vote_exists(current_user.id, queried_idea.id): edit_vote( get_vote(current_user.id, queried_idea.id).id, request.form.get('value')) else: future_vote = Vote(owner=current_user, target=queried_idea, value=request.form.get('value')) save_vote(future_vote) return redirect_back()
def single_pitch(id): pitch = Pitch.query.get(id) if pitch is None: abort(404) reviews = Review.get_reviews(pitch.id) vote_count = Vote.get_vote_count(pitch.id) vote_dict = {} for type, count in vote_count: vote_dict[type] = count return render_template( 'pitch/pitch.html', pitch=pitch, vote_count=vote_dict, reviews=reviews, reviewform=ReviewForm(), voteform=VoteForm() )
def upvote(): data = request.get_json() db = get_db() try: # create a new vote with incoming id and session id newVote = Vote(post_id=data['post_id'], user_id=session.get('user_id')) db.add(newVote) db.commit() except: print(sys.exc_info()[0]) db.rollback() return jsonify(message='Upvote failed'), 500 return '', 204
def get(self, page, json): """Interface for logged in user to vote""" # Base class for app engine doesn't allow defaulting arguments with # kwargs if not page: page = 1 next_page = int(page) + 1 # Get 20 most recent tweets from friends/user url = ''.join( ['http://api.twitter.com/1/statuses/home_timeline.json']) try: (status_code, timeline) = self.send_twitter_request(url, additional_params={'page': page}) except NotLoggedIn: return self.render_template('error.html', msg="Must be logged in") if status_code != 200: return self.render_template('error.html', msg='Status %d returned' % (status_code)) tweets = [] user = self.get_logged_in_user() votes = VoteModel.all().filter('voter = ', user) for entry in timeline: tweet = {} tweet['profile_image_url'] = entry['user']['profile_image_url'] tweet['author_screen_name'] = entry['user']['screen_name'] tweet['author_name'] = entry['user']['name'] tweet['text'] = entry['text'] tweet['id'] = entry['id_str'] tweet['vote_cnt'] = 0 tweet['created_at'] = datetime.datetime.strptime( entry['created_at'], "%a %b %d %H:%M:%S +0000 %Y") if json: tweet['created_at'] = str(tweet['created_at']) for vote in votes: if vote.tweet.id == entry['id_str']: tweet['vote_cnt'] = vote.count tweets.append(tweet) if json: html = "" for tweet in tweets: path = os.path.join(os.path.dirname(__file__), TEMPLATE_DIR + 'tweet_vote.html') html += template.render(path, {'tweet': tweet}) return self.response.out.write(simplejson.dumps( {'html': html, 'page': next_page})) return self.render_template('vote.html', user_name=user.user_name, tweets=tweets, page=next_page)
def votes(request, game_id, round_id, thread_id): thread = Thread.get_by_uid(thread_id) game = Game.get_by_uid(game_id) if thread is None: raise Http404 if not thread.profile_can_view(request.profile): return HttpResponse('Unauthorized', status=401) if request.method == 'GET': since = request.GET.get('since', None) return json(Vote.get_activities(request.user, thread, since=since)) if request.method == 'POST': if not thread.profile_can_create(request.profile): return HttpResponse('Unauthorized', status=401) # find the target target_id = request.POST.get('target_id', None) if target_id is None: raise Exception('No target') target_profile = Profile.get_by_uid(target_id) target = Role.all().filter('player', target_profile) target = target.filter('game', game) target = target.fetch(1)[0] # find the last vote this user made (if any) game = Game.get_by_uid(game_id) actor = Role.get_by_profile(game, request.profile) last_vote = Vote.all().filter("thread", thread) last_vote = last_vote.filter("actor", actor) last_vote = last_vote.order("-created") try: last_vote = last_vote.fetch(1)[0] except IndexError, e: last_vote = None # if we found a vote, decrement that vote's counter if last_vote is not None: last_vote.decrement() # create the new vote vote = Vote(actor=actor, target=target, thread=thread) vote.put() # increment the counter vote.increment() if thread.name == role_vanillager: vote_count = Vote.all().filter('thread', thread).count() if not vote_count: # First vote in round c = Client(settings.BDM_SECRET, settings.BDM_KEY) eul = "profile:%s" % request.profile.uid c.post("named_transaction_group/613301/execute/%s" % eul) if thread.round.number == 1: # First vote in game c.post("named_transaction_group/613302/execute/%s" % eul) return json(vote)
def end_round(request, game_id, round_id): t = datetime.now() logging.debug('task end round started on game:%s round:%s' % \ (game_id, round_id)) round = Round.all().filter('uid', round_id).get() game = round.game if not round.uid == game.get_current_round().uid: raise FactionizeTaskException, 'Round argument is not the current round. Check if task has been repeated' village_thread = round.get_thread(role_vanillager) sheriff_thread = round.get_thread(role_sheriff) doctor_thread = round.get_thread(role_doctor) mafia_thread = round.get_thread(role_mafia) vote_death_role = get_thread_highest_vote(village_thread) logging.debug(('game:%s round:%s vote kill role_id:%s (%s) ' + \ 'profile_name:%s google_id:%s') % \ (game.uid, round.uid, vote_death_role.uid, vote_death_role.name, vote_death_role.player.name, vote_death_role.player.user.user_id())) if vote_death_role.name in [role_sheriff, role_doctor]: kill_in_threads(vote_death_role, [doctor_thread, sheriff_thread]) vote_death_role.kill(role_vanillager, round.number) death = DeathByVote(actor=vote_death_role, vote_thread=village_thread, thread=village_thread) doctor_saves = [x.role for x in filter(lambda x: x.total, doctor_thread.votesummary_set) \ if x.total] sheriff_reveals = [x.role for x in filter(lambda x: x.total, sheriff_thread.votesummary_set) \ if x.total] sheriff_reveals = filter(lambda x: x.uid != vote_death_role.uid, sheriff_reveals) if len(sheriff_reveals): # we know a reveal is valid and who should be revealed, but # not who did it, so figure that out revealers = filter_invalidated(Vote.all().filter('thread', sheriff_thread)) for r in revealers: logging.debug(('game:%s round:%s sheriff reveal actor:%s ' + \ 'target:%s role:%s') % \ (game.uid, round.uid, r.actor.uid, r.target.uid, r.target.name)) reveal = Reveal(actor=r.actor, target=r.target, thread=r.thread) reveal.put() mafia_vote_death = get_thread_highest_vote(mafia_thread) if mafia_vote_death.uid in [ds.uid for ds in doctor_saves]: # we know that somebody successfully saved, but not who yet # figure that out here saviours = filter_invalidated(Vote.all().filter('thread', doctor_thread)) for s in filter(lambda x: x.target.uid == mafia_vote_death.uid, saviours): logging.debug(('game:%s round:%s nurse save actor:%s target:%s' + \ 'role:%s') % \ (game.uid, round.uid, s.actor.uid, s.target.uid, s.target.name)) save = Save(actor=s.actor, target=s.target, thread=village_thread) save.put() else: logging.debug(('game:%s round:%s mafia kill role_id:%s (%s) ' + \ 'profile_name:%s google_id:%s') % \ (game.uid, round.uid, mafia_vote_death.uid, mafia_vote_death.name, mafia_vote_death.player.name, mafia_vote_death.player.user.user_id())) mafia_vote_death.kill(role_mafia, round.number) death = DeathByVote(actor=mafia_vote_death, vote_thread=mafia_thread, thread=village_thread) death.put() if not game.is_over(): logging.debug('game:%s round:%s starting next round' % \ (game.uid, round.uid)) r = game.start_next_round() logging.debug('game:%s started new round:%s' % (game.uid, r.uid)) assert r.number == round.number + 1 # sanity check taskqueue.add(url=reverse('end_round', kwargs={'game_id':game.uid, 'round_id':r.uid}), method='POST', countdown=r.length()) else: logging.debug('game:%s round:%s has hit the end game condition' % \ (game.uid, round.uid)) taskqueue.add(url=reverse('end_game', kwargs={'game_id':game.uid}), method='POST') logging.debug('game:%s round:%s end round total_time:%s' % \ (game.uid, round.uid, (datetime.now() - t).seconds)) return HttpResponse('ok', status=200)