コード例 #1
0
ファイル: people.py プロジェクト: leeccong/code
 def contributions(self, request):
     res = {}
     for date_, contribution in UserContributions.get_by_user(self.name).iteritems():
         timestamp = time.mktime(datetime.strptime(date_, "%Y-%m-%d").timetuple())
         score = contribution[0]
         res.setdefault(timestamp, score)
     return res
コード例 #2
0
ファイル: people.py プロジェクト: jackfrued/code-1
 def contributions(self, request):
     res = {}
     for date_, contribution in UserContributions.get_by_user(
             self.name).iteritems():
         timestamp = time.mktime(
             datetime.strptime(date_, '%Y-%m-%d').timetuple())
         score = contribution[0]
         res.setdefault(timestamp, score)
     return res
コード例 #3
0
 def contributions(self, request):
     res = {}
     days = int(request.get_form_var('days', 31))
     for date_, contribution in UserContributions.get_by_user(
             self.user.name, days=days).iteritems():
         timestamp = time.mktime(
             datetime.strptime(date_, '%Y-%m-%d').timetuple())
         score = contribution[0]
         res.setdefault(timestamp, score)
     return res
コード例 #4
0
ファイル: users.py プロジェクト: 000fan000/code
 def contributions(self, request):
     res = {}
     days = int(request.get_form_var('days', 31))
     for date_, contribution in UserContributions.get_by_user(
             self.user.name, days=days).iteritems():
         timestamp = time.mktime(
             datetime.strptime(date_, '%Y-%m-%d').timetuple())
         score = contribution[0]
         res.setdefault(timestamp, score)
     return res
コード例 #5
0
ファイル: people.py プロジェクト: leeccong/code
 def contribution_detail(self, request):
     req_date = request.get_form_var("date")
     if req_date:
         try:
             req_date = dateutil.parser.parse(req_date).astimezone(dateutil.tz.tzoffset("EST", 8 * 3600))
         except ValueError as e:
             return ""
         contributions = UserContributions.get_by_date(self.name, req_date)
         owned = contributions.get("owned_tickets")
         commented = contributions.get("commented_tickets")
         owned_tickets = filter(None, [Ticket.get(id_) for id_ in owned])
         commented_tickets = filter(None, [Ticket.get(comment[0]) for comment in commented])
         return st("people_contribution_detail.html", **locals())
     return ""
コード例 #6
0
ファイル: people.py プロジェクト: jackfrued/code-1
 def contribution_detail(self, request):
     req_date = request.get_form_var('date')
     if req_date:
         try:
             req_date = dateutil.parser.parse(req_date).astimezone(
                 dateutil.tz.tzoffset('EST', 8 * 3600))
         except ValueError as e:
             return ""
         contributions = UserContributions.get_by_date(self.name, req_date)
         owned = contributions.get('owned_tickets')
         commented = contributions.get('commented_tickets')
         owned_tickets = filter(None, [Ticket.get(id_) for id_ in owned])
         commented_tickets = filter(
             None, [Ticket.get(comment[0]) for comment in commented])
         return st('people_contribution_detail.html', **locals())
     return ""
コード例 #7
0
 def contribution_detail(self, request):
     req_date = request.get_form_var('date')
     if not req_date:
         return {"error": "No datetime"}
     try:
         req_date = dateutil.parser.parse(req_date).astimezone(
             dateutil.tz.tzoffset('EST', 8 * 3600))
     except ValueError:
         return {"error": "Invalid date"}
     contributions = UserContributions.get_by_date(self.user.name, req_date)
     owned = contributions.get('owned_tickets')
     commented = contributions.get('commented_tickets')
     pullreqs = [Ticket.get(id_).as_dict() for id_ in owned]
     participated = [
         Ticket.get(comment[0]).as_dict() for comment in commented
     ]
     return {"pull requests": pullreqs, "participated": participated}
コード例 #8
0
ファイル: users.py プロジェクト: 000fan000/code
 def contribution_detail(self, request):
     req_date = request.get_form_var('date')
     if not req_date:
         return {"error": "No datetime"}
     try:
         req_date = dateutil.parser.parse(req_date).astimezone(
             dateutil.tz.tzoffset('EST', 8 * 3600))
     except ValueError:
         return {"error": "Invalid date"}
     contributions = UserContributions.get_by_date(self.user.name, req_date)
     owned = contributions.get('owned_tickets')
     commented = contributions.get('commented_tickets')
     pullreqs = [Ticket.get(id_).as_dict() for id_ in owned]
     participated = [Ticket.get(comment[0]).as_dict()
                     for comment in commented]
     return {"pull requests": pullreqs,
             "participated": participated}
コード例 #9
0
ファイル: tasks.py プロジェクト: leeccong/code
def update_user_contributions():
    from vilya.models.contributions import UserContributions
    users = get_users()
    for user in users:
        UserContributions.update_by_user(user.name)
コード例 #10
0
def update_user_contributions():
    from vilya.models.contributions import UserContributions
    users = get_users()
    for user in users:
        UserContributions.update_by_user(user.name)