scoreboard icon indicating copy to clipboard operation
scoreboard copied to clipboard

Output `--solvestats` as a file

Open RagnarGrootKoerkamp opened this issue 5 years ago • 1 comments

For BAPC I created a run.sh script as follows (login params omitted)

bazel run analysis:activity -- \
~/git/bapc/2019/bapc/solve_stats

bazel run analysis:activity -- \
--solvestats > ~/git/bapc/2019/bapc/solve_stats/problem_stats.tex

It would be really nice to directly create the problem_stats.tex (or probably solve_stats.tex) when running analysis:activity. The output I used was:

\newcommand{\solvestatsD}{\printsolvestats{26}{1}{11}}
\newcommand{\solvestatsH}{\printsolvestats{100}{26}{29}}
\newcommand{\solvestatsB}{\printsolvestats{57}{56}{0}}
\newcommand{\solvestatsL}{\printsolvestats{3}{2}{0}}
\newcommand{\solvestatsF}{\printsolvestats{100}{20}{27}}
\newcommand{\solvestatsC}{\printsolvestats{1}{1}{0}}
\newcommand{\solvestatsI}{\printsolvestats{20}{1}{7}}
\newcommand{\solvestatsJ}{\printsolvestats{80}{56}{0}}
\newcommand{\solvestatsE}{\printsolvestats{124}{23}{37}}
\newcommand{\solvestatsA}{\printsolvestats{15}{3}{8}}
\newcommand{\solvestatsG}{\printsolvestats{52}{10}{22}}

RagnarGrootKoerkamp avatar Oct 21 '19 19:10 RagnarGrootKoerkamp

Btw, the LaTeX header I used with it is:

\newcommand{\problemletter}{} % Empty to hide activity chart

% If solve_stats/activity/A.tex exists, define the \activitychart command
\IfFileExists{./solve_stats/activity/A.tex}{
	\newcommand{\activitychart}{
	  \ifdefempty{\problemletter}{}{
		\includestandalone[width=\textwidth]{solve_stats/activity/\problemletter}
	  }
	}
}{
	\newcommand{\activitychart}{}
}

\newcommand{\printsolvestats}[3]{%
	\vfill
	\onslide<+->
	Statistics: #1 submissions, #2 accepted, #3 unknown%
}

% Define \solvestats for the current problem if the file exists.
\IfFileExists{./solve_stats/problem_stats.tex}{
	\newcommand{\solvestats}{\csname solvestats\problemletter \endcsname}
	\input{./solve_stats/problem_stats.tex}
}{
	\newcommand{\solvestats}{}
}

It might be nice to generate this as a separate file as well so users of the tool don't have to remember/copy this or figure it out otherwise.

\printsolvestats is the only customization punt here, so maybe that one should be user defined and the rest can be generated. (But then add a latex comment about this in the generated file anyway maybe.)

RagnarGrootKoerkamp avatar Oct 21 '19 19:10 RagnarGrootKoerkamp