\n{|\n| width=50% |\n{| class='wikitable sortable'\n|+\n!Nom d'usuari\n! style='width:35%' | Articles enllaçats\n|-\n"
+
+ sorted_rank = sorted(results.iteritems(), key=lambda x: x[1], reverse=True)
+
+ countdown = datetime.datetime(2019, 9, 17) - datetime.datetime.today()
+ days_elapsed = datetime.datetime.today() - datetime.datetime(2019, 8, 16)
+
+ total = int(gec_overview.get("manual")) - INIT_MATCHED_ELEMENTS
+ for elem in sorted_rank:
+ output_table += u"| {{{{utot|{0}}}}}\n| {1}\n|-\n".format(elem[0], elem[1])
+ output_table += u"|}\n"
+ output_table += u"| width=5% |\n| align=center |\n'''{0}'''" \
+ u"
emparellaments
totals fets
\n" \
+ u"'''{1}%'''
assolit
fins ara
\n" \
+ u"'''{2}'''
emparellaments fets/dia
\n| align=center |\n'''{3}'''
voluntaris
participants
\n'''{4}'''
emparellaments restants
\n'''{5}'''
dies
restants
\n|}}".format(\
+ total, \
+ round((total * 1.0 / (100000 - INIT_MATCHED_ELEMENTS)) * 100, 2), \
+ total / days_elapsed.days, \
+ len(sorted_rank), \
+ 100000 - total - INIT_MATCHED_ELEMENTS, \
+ countdown.days)
+ return output_table
+
+def save(output):
+ if DEBUG_MODE:
+ print output
+ else:
+ site = pywikibot.Site("ca", "wikipedia")
+ page = pywikibot.Page(site, u"Viquiprojecte:Viquirepte/GEC/Participants auto")
+ page.put(output, u'Actualitzant la classificació del Viquirepte')
+ print page
+
+def main():
+
+ json_content_overview = urllib2.urlopen(URL_OVERVIEW).read()
+ json_object_overview = json.loads(json_content_overview)
+
+ json_content_catalogue = urllib2.urlopen(URL_CATALOGUE).read()
+ json_object_catalogue = json.loads(json_content_catalogue)
+
+ if json_object_catalogue.get("status") == "OK" and json_object_overview.get("status") == "OK":
+ results = count_points(json_object_catalogue.get("data").get("user"))
+ output = print_results(results, json_object_overview.get(u"data").get(u"109"))
+ save(output)
+
+if __name__ == '__main__':
+ main()
\ No newline at end of file