From 991cb0ed962f348761ad473aa5ce5c0da12333ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davi=20Ant=C3=B4nio?= <30875784+DaviAntonio@users.noreply.github.com> Date: Thu, 30 Mar 2023 11:48:17 +0000 Subject: Release 1.5.18-1 (#28) * Update version info and year The following files were updated to the next version to be released and the current year: - src/version - src/versionnum.php * Release 1.5.17-1 Update changelog with all the changes made since its last update on commit 818abd88. * Format code with black 23.1.0 * Release 1.5.18-1 Update changelog with all the changes made since its last update on commit 194f6764. --- debian/changelog | 12 ++++++++++ src/admin/report/barplot.py | 16 ++++++------- src/admin/report/piechart.py | 57 ++++++++++++++++++++++++++++---------------- 3 files changed, 56 insertions(+), 29 deletions(-) diff --git a/debian/changelog b/debian/changelog index 6dfb332..c78529b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +boca (1.5.18-1) jammy; urgency=medium + + [ Bruno Ribas ] + * private/score.sep: more sane default + * barplot.py: moved to the correct location + * d/control: add python3-matplotlib as depends for boca-web + + [ Davi Antônio da Silva Santos ] + * Format code with black 23.1.0 + + -- Davi Antônio da Silva Santos Wed, 29 Mar 2023 17:09:19 -0300 + boca (1.5.17-1) jammy; urgency=medium [ Bruno Ribas ] diff --git a/src/admin/report/barplot.py b/src/admin/report/barplot.py index d07f156..edc9df1 100644 --- a/src/admin/report/barplot.py +++ b/src/admin/report/barplot.py @@ -5,23 +5,23 @@ filename = sys.argv[1] title = sys.argv[2] -x = [str(x) + '-' + str(x+10) for x in range(0,300,10)] +x = [str(x) + "-" + str(x + 10) for x in range(0, 300, 10)] -with open(filename,'r') as file: +with open(filename, "r") as file: y = [int(line) for line in file] # Create a bar plot -plt.bar(x, y,width=0.5) +plt.bar(x, y, width=0.5) # Set the y-axis tick labels to step by 5 plt.xticks(rotation=90) -if(max(y)<200): - plt.yticks(range(0, max(y)+1, 5)) +if max(y) < 200: + plt.yticks(range(0, max(y) + 1, 5)) else: - plt.yticks(range(0, max(y)+1, 10)) + plt.yticks(range(0, max(y) + 1, 10)) # Add gridlines to the y-axis -plt.grid(axis='y') +plt.grid(axis="y") # Add a title to the plot plt.title(title) @@ -29,4 +29,4 @@ plt.title(title) plt.tight_layout() # Show the plot -plt.savefig(filename.replace('.txt','.png'),dpi=600,transparent=True) +plt.savefig(filename.replace(".txt", ".png"), dpi=600, transparent=True) diff --git a/src/admin/report/piechart.py b/src/admin/report/piechart.py index 75e5a9d..70904bb 100644 --- a/src/admin/report/piechart.py +++ b/src/admin/report/piechart.py @@ -4,37 +4,52 @@ import sys filename = sys.argv[1] title = sys.argv[2] -label=[] -value=[] +label = [] +value = [] color = [] -with open(filename,'r') as f: +with open(filename, "r") as f: for line in f: tokens = line.split() c = tokens[-1] - problem_data = ' '.join(tokens[0:-1]) - l,v = problem_data.split(':') - if(int(v)>0): - label.append(l+'('+v+')') + problem_data = " ".join(tokens[0:-1]) + l, v = problem_data.split(":") + if int(v) > 0: + label.append(l + "(" + v + ")") value.append(v) color.append(c) -wedges, texts, autotexts = plt.pie(value, colors=color,autopct=lambda p: '{:.1f}%'.format(round(p)) if p > 0 else '',pctdistance=1.2,wedgeprops= {"edgecolor":"black", - 'linewidth': 1, - 'antialiased': False}) +wedges, texts, autotexts = plt.pie( + value, + colors=color, + autopct=lambda p: "{:.1f}%".format(round(p)) if p > 0 else "", + pctdistance=1.2, + wedgeprops={"edgecolor": "black", "linewidth": 1, "antialiased": False}, +) -plt.legend(wedges, label, - loc="center left", - bbox_to_anchor=(1.1, 0, 0.5,1)) +plt.legend(wedges, label, loc="center left", bbox_to_anchor=(1.1, 0, 0.5, 1)) # Add title -plt.title(title,pad=20) -if(len(sys.argv)<=3): - plt.legend(label, bbox_to_anchor=(1.1,0.5), loc="center right", fontsize=10, - bbox_transform=plt.gcf().transFigure,shadow=True) +plt.title(title, pad=20) +if len(sys.argv) <= 3: + plt.legend( + label, + bbox_to_anchor=(1.1, 0.5), + loc="center right", + fontsize=10, + bbox_transform=plt.gcf().transFigure, + shadow=True, + ) else: - plt.legend(label,loc="lower center", bbox_to_anchor=(0.5,-0.1), fontsize=10, - bbox_transform=plt.gcf().transFigure,shadow=True) + plt.legend( + label, + loc="lower center", + bbox_to_anchor=(0.5, -0.1), + fontsize=10, + bbox_transform=plt.gcf().transFigure, + shadow=True, + ) # Show plot # plt.tight_layout() -plt.savefig(filename.replace('.txt','.png'),dpi=600,transparent=True, bbox_inches="tight") - +plt.savefig( + filename.replace(".txt", ".png"), dpi=600, transparent=True, bbox_inches="tight" +) -- cgit v1.2.3 From 98d9dd26e241b0a7a494af02262ab5e1f7eb3aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Laiola=20Guimar=C3=A3es?= Date: Mon, 17 Apr 2023 09:13:40 -0300 Subject: Update autojudging.php (#30) --- src/private/autojudging.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/private/autojudging.php b/src/private/autojudging.php index e44aaeb..83e2bdd 100755 --- a/src/private/autojudging.php +++ b/src/private/autojudging.php @@ -79,10 +79,10 @@ $key=md5(mt_rand() . rand() . mt_rand()); $cf = globalconf(); $ip = $cf["ip"]; -$activecontest=DBGetActiveContest(); $prevsleep=0; //$dodebug=1; while(42) { + $activecontest=DBGetActiveContest(); if(($run = DBGetRunToAutojudging($activecontest["contestnumber"], $ip)) === false) { if($prevsleep==0) -- cgit v1.2.3 From b7c5e309c728840a42eeec3113f2f58f6834eed9 Mon Sep 17 00:00:00 2001 From: Daniel Saad Nogueira Nunes Date: Thu, 24 Aug 2023 22:13:57 -0300 Subject: fscore.php: now CE, Name Mismatch and Contact staff do not generate penalties. (#31) --- src/fscore.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/fscore.php b/src/fscore.php index 6faeb63..df3fce3 100644 --- a/src/fscore.php +++ b/src/fscore.php @@ -365,10 +365,13 @@ function DBScoreSite($contest, $site, $verifylastmile, $hor=-1, $data=null) { $resp[$user . '-' . $site]["problem"][$problem]["count"] = 0; while ($i<$n && $a[$i]["anstime"] <= $ta && $a[$i]["user"]==$user && $a[$i]["problem"]==$problem && $a[$i]["yes"]!='t') { - $time += (int) (($ct["contestpenalty"])/60); - $k++; - $i++; + // now CE, Name Mismatch and Contact Staff do not generate penalties + if($a[$i]["answer"] != '2' && $a[$i]["answer"] != '7' && $a[$i]["answer"] != '8') + $time += (int) (($ct["contestpenalty"])/60); + $k++; + $i++; } + $resp[$user . '-' . $site]["problem"][$problem]["count"] = $k; if ($i>=$n) break; -- cgit v1.2.3 From 8431900f5f128ea29394b9e51c3febd4b92e1a22 Mon Sep 17 00:00:00 2001 From: Daniel Saad Nogueira Nunes Date: Thu, 24 Aug 2023 23:08:55 -0300 Subject: scorelower.php: usernames starting with scoreboss* bypass the frozen scoreboard (#32) --- src/scorelower.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/scorelower.php b/src/scorelower.php index 62165f1..f4b88b1 100644 --- a/src/scorelower.php +++ b/src/scorelower.php @@ -36,6 +36,9 @@ if($_SESSION["usertable"]["usertype"]=='staff') $ver=false; if($_SESSION["usertable"]["usertype"]=="score") $des=false; else $des=true; +if($_SESSION["usertable"]["usertype"]=="score" && substr($_SESSION["usertable"]["username"],0,9) == "scoreboss" ) $ver=false; + + // temp do carlinhos (placar de judge == placar de time) //if ($_SESSION["usertable"]["usertype"]=="judge") $ver = true; -- cgit v1.2.3 From 48cd64a927eda583347b70c223c4b5cfa28c9582 Mon Sep 17 00:00:00 2001 From: Bruno Ribas Date: Mon, 28 Aug 2023 19:22:36 -0300 Subject: mv postgresql/{10,14} --- tools/postgresql/10/main/conf.d/000-boca.conf | 1 - tools/postgresql/10/main/pg_hba.conf | 101 -------------------------- tools/postgresql/14/main/conf.d/000-boca.conf | 1 + tools/postgresql/14/main/pg_hba.conf | 101 ++++++++++++++++++++++++++ 4 files changed, 102 insertions(+), 102 deletions(-) delete mode 100644 tools/postgresql/10/main/conf.d/000-boca.conf delete mode 100644 tools/postgresql/10/main/pg_hba.conf create mode 100644 tools/postgresql/14/main/conf.d/000-boca.conf create mode 100644 tools/postgresql/14/main/pg_hba.conf diff --git a/tools/postgresql/10/main/conf.d/000-boca.conf b/tools/postgresql/10/main/conf.d/000-boca.conf deleted file mode 100644 index 128ef1a..0000000 --- a/tools/postgresql/10/main/conf.d/000-boca.conf +++ /dev/null @@ -1 +0,0 @@ -listen_addresses = '*' diff --git a/tools/postgresql/10/main/pg_hba.conf b/tools/postgresql/10/main/pg_hba.conf deleted file mode 100644 index 4eeaa6e..0000000 --- a/tools/postgresql/10/main/pg_hba.conf +++ /dev/null @@ -1,101 +0,0 @@ -# PostgreSQL Client Authentication Configuration File -# =================================================== -# -# Refer to the "Client Authentication" section in the PostgreSQL -# documentation for a complete description of this file. A short -# synopsis follows. -# -# This file controls: which hosts are allowed to connect, how clients -# are authenticated, which PostgreSQL user names they can use, which -# databases they can access. Records take one of these forms: -# -# local DATABASE USER METHOD [OPTIONS] -# host DATABASE USER ADDRESS METHOD [OPTIONS] -# hostssl DATABASE USER ADDRESS METHOD [OPTIONS] -# hostnossl DATABASE USER ADDRESS METHOD [OPTIONS] -# -# (The uppercase items must be replaced by actual values.) -# -# The first field is the connection type: "local" is a Unix-domain -# socket, "host" is either a plain or SSL-encrypted TCP/IP socket, -# "hostssl" is an SSL-encrypted TCP/IP socket, and "hostnossl" is a -# plain TCP/IP socket. -# -# DATABASE can be "all", "sameuser", "samerole", "replication", a -# database name, or a comma-separated list thereof. The "all" -# keyword does not match "replication". Access to replication -# must be enabled in a separate record (see example below). -# -# USER can be "all", a user name, a group name prefixed with "+", or a -# comma-separated list thereof. In both the DATABASE and USER fields -# you can also write a file name prefixed with "@" to include names -# from a separate file. -# -# ADDRESS specifies the set of hosts the record matches. It can be a -# host name, or it is made up of an IP address and a CIDR mask that is -# an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that -# specifies the number of significant bits in the mask. A host name -# that starts with a dot (.) matches a suffix of the actual host name. -# Alternatively, you can write an IP address and netmask in separate -# columns to specify the set of hosts. Instead of a CIDR-address, you -# can write "samehost" to match any of the server's own IP addresses, -# or "samenet" to match any address in any subnet that the server is -# directly connected to. -# -# METHOD can be "trust", "reject", "md5", "password", "scram-sha-256", -# "gss", "sspi", "ident", "peer", "pam", "ldap", "radius" or "cert". -# Note that "password" sends passwords in clear text; "md5" or -# "scram-sha-256" are preferred since they send encrypted passwords. -# -# OPTIONS are a set of options for the authentication in the format -# NAME=VALUE. The available options depend on the different -# authentication methods -- refer to the "Client Authentication" -# section in the documentation for a list of which options are -# available for which authentication methods. -# -# Database and user names containing spaces, commas, quotes and other -# special characters must be quoted. Quoting one of the keywords -# "all", "sameuser", "samerole" or "replication" makes the name lose -# its special character, and just match a database or username with -# that name. -# -# This file is read on server startup and when the server receives a -# SIGHUP signal. If you edit the file on a running system, you have to -# SIGHUP the server for the changes to take effect, run "pg_ctl reload", -# or execute "SELECT pg_reload_conf()". -# -# Put your actual configuration here -# ---------------------------------- -# -# If you want to allow non-local connections, you need to add more -# "host" records. In that case you will also need to make PostgreSQL -# listen on a non-local interface via the listen_addresses -# configuration parameter, or via the -i or -h command line switches. - - - - -# DO NOT DISABLE! -# If you change this first entry you will need to make sure that the -# database superuser can access the database using some other method. -# Noninteractive access to all databases is required during automatic -# maintenance (custom daily cronjobs, replication, and similar tasks). -# -# Database administrative login by Unix domain socket -local all postgres peer - -# TYPE DATABASE USER ADDRESS METHOD - -# "local" is for Unix domain socket connections only -local all all peer -# IPv4 local connections: -host all all 127.0.0.1/32 md5 -# IPv6 local connections: -host all all ::1/128 md5 -# Allow replication connections from localhost, by a user with the -# replication privilege. -local replication all peer -host replication all 127.0.0.1/32 md5 -host replication all ::1/128 md5 -host bocadb bocauser 0/0 md5 -host postgres replication 0/0 md5 diff --git a/tools/postgresql/14/main/conf.d/000-boca.conf b/tools/postgresql/14/main/conf.d/000-boca.conf new file mode 100644 index 0000000..128ef1a --- /dev/null +++ b/tools/postgresql/14/main/conf.d/000-boca.conf @@ -0,0 +1 @@ +listen_addresses = '*' diff --git a/tools/postgresql/14/main/pg_hba.conf b/tools/postgresql/14/main/pg_hba.conf new file mode 100644 index 0000000..4eeaa6e --- /dev/null +++ b/tools/postgresql/14/main/pg_hba.conf @@ -0,0 +1,101 @@ +# PostgreSQL Client Authentication Configuration File +# =================================================== +# +# Refer to the "Client Authentication" section in the PostgreSQL +# documentation for a complete description of this file. A short +# synopsis follows. +# +# This file controls: which hosts are allowed to connect, how clients +# are authenticated, which PostgreSQL user names they can use, which +# databases they can access. Records take one of these forms: +# +# local DATABASE USER METHOD [OPTIONS] +# host DATABASE USER ADDRESS METHOD [OPTIONS] +# hostssl DATABASE USER ADDRESS METHOD [OPTIONS] +# hostnossl DATABASE USER ADDRESS METHOD [OPTIONS] +# +# (The uppercase items must be replaced by actual values.) +# +# The first field is the connection type: "local" is a Unix-domain +# socket, "host" is either a plain or SSL-encrypted TCP/IP socket, +# "hostssl" is an SSL-encrypted TCP/IP socket, and "hostnossl" is a +# plain TCP/IP socket. +# +# DATABASE can be "all", "sameuser", "samerole", "replication", a +# database name, or a comma-separated list thereof. The "all" +# keyword does not match "replication". Access to replication +# must be enabled in a separate record (see example below). +# +# USER can be "all", a user name, a group name prefixed with "+", or a +# comma-separated list thereof. In both the DATABASE and USER fields +# you can also write a file name prefixed with "@" to include names +# from a separate file. +# +# ADDRESS specifies the set of hosts the record matches. It can be a +# host name, or it is made up of an IP address and a CIDR mask that is +# an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that +# specifies the number of significant bits in the mask. A host name +# that starts with a dot (.) matches a suffix of the actual host name. +# Alternatively, you can write an IP address and netmask in separate +# columns to specify the set of hosts. Instead of a CIDR-address, you +# can write "samehost" to match any of the server's own IP addresses, +# or "samenet" to match any address in any subnet that the server is +# directly connected to. +# +# METHOD can be "trust", "reject", "md5", "password", "scram-sha-256", +# "gss", "sspi", "ident", "peer", "pam", "ldap", "radius" or "cert". +# Note that "password" sends passwords in clear text; "md5" or +# "scram-sha-256" are preferred since they send encrypted passwords. +# +# OPTIONS are a set of options for the authentication in the format +# NAME=VALUE. The available options depend on the different +# authentication methods -- refer to the "Client Authentication" +# section in the documentation for a list of which options are +# available for which authentication methods. +# +# Database and user names containing spaces, commas, quotes and other +# special characters must be quoted. Quoting one of the keywords +# "all", "sameuser", "samerole" or "replication" makes the name lose +# its special character, and just match a database or username with +# that name. +# +# This file is read on server startup and when the server receives a +# SIGHUP signal. If you edit the file on a running system, you have to +# SIGHUP the server for the changes to take effect, run "pg_ctl reload", +# or execute "SELECT pg_reload_conf()". +# +# Put your actual configuration here +# ---------------------------------- +# +# If you want to allow non-local connections, you need to add more +# "host" records. In that case you will also need to make PostgreSQL +# listen on a non-local interface via the listen_addresses +# configuration parameter, or via the -i or -h command line switches. + + + + +# DO NOT DISABLE! +# If you change this first entry you will need to make sure that the +# database superuser can access the database using some other method. +# Noninteractive access to all databases is required during automatic +# maintenance (custom daily cronjobs, replication, and similar tasks). +# +# Database administrative login by Unix domain socket +local all postgres peer + +# TYPE DATABASE USER ADDRESS METHOD + +# "local" is for Unix domain socket connections only +local all all peer +# IPv4 local connections: +host all all 127.0.0.1/32 md5 +# IPv6 local connections: +host all all ::1/128 md5 +# Allow replication connections from localhost, by a user with the +# replication privilege. +local replication all peer +host replication all 127.0.0.1/32 md5 +host replication all ::1/128 md5 +host bocadb bocauser 0/0 md5 +host postgres replication 0/0 md5 -- cgit v1.2.3