Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide hiddenAnimals input #590

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,11 @@ etc/*.yaml
etc/*.secret
public/
conftools/
thirdparty/build.log
thirdparty/cache
thirdparty/carton/
thirdparty/latest-build
thirdparty/touch
thirdparty/lib/
thirdparty/work/
thirdparty/bin/
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
perl system
34 changes: 9 additions & 25 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,33 +1,17 @@
# Copyright (C) 2020 Fritz Zaucker
# Copyright (C) 2023 Fritz Zaucker

AUTOMAKE_OPTIONS = foreign
AUTOMAKE_OPTIONS = foreign

SUBDIRS = etc frontend

PUB := $(shell find -L public -type d \( -name ".??*" -o -name transpiled \) -prune -o -not -name "*db.json" -a -not -name "*.map" -a -not -name "*~" -a -not -name transpiled -a -not -name "*.tmp" -a -type f -print )
SHARE := $(shell test -d share && find -L share -type d -name ".??*" -prune -o -not -name ".*" -a -not -name "*~" -a -not -name "*.tmp" -a -not -name '*.sql' -a -not -wholename '*/Docu/*' -a -not -wholename '*/Docu' -a -not -wholename '*/_Attic' -a -not -wholename '*/_Attic/*' -a -type f -print)

PERLTESTS := $(shell find -L t -name "*.t")
PM := $(shell find -L lib -name "*.pm")

#EXTRA_DIST = META6.json COPYRIGHT LICENSE CHANGES AUTHORS bootstrap $(PUB) $(POD) $(TEMPL) $(SHARE)

EXTRA_DIST = META6.json COPYRIGHT bin lib/Agrammon bootstrap $(PUB) $(SHARE) # $(PERLTESTS)
SUBDIRS = thirdparty etc frontend

YEAR := $(shell date +%Y)
DATE := $(shell date +%Y-%m-%d)

datadir = $(prefix)
nobase_data_DATA = $(PUB) $(TEMPL) $(SHARE)

README.md COPYRIGHT:
$(PERL) -i -p -e 's/(#VERSION#|\d+\.\d+\.\d+[^.\s]*)/$(PACKAGE_VERSION)/g;s/(#YEAR#|20[1-9]\d)/$(YEAR)/g;s/(#DATE#|20[1-9]\d-[01]\d-[0-3]\d)/$(DATE)/g;' $@
PUB := $(shell find -L public -type d \( -name ".??*" -o -name transpiled \) -prune -o -not -name "*db.json" -a -not -name "*.map" -a -not -name "*~" -a -not -name transpiled -a -not -name "*.tmp" -a -type f -print )

TEMPL := $(shell test -d templates && find -L templates -type f -name "*.ep")
SHARE := $(shell test -d share && find -L share -type d -name ".??*" -prune -o -not -name ".*" -a -not -name "*~" -a -not -name "*.tmp" -a -type f -print)

LANGUAGES := $(shell $(PERL) -e 'use JSON::PP qw(decode_json); print join(" ", map {"share/".$$_.".po"} @{decode_json(join("",<>))->{locales}})' frontend/compile.json)
PERLTESTS := $(shell find t -name "*.t")
PM := $(shell find lib -name "*.pm")

test:
prove -j8 -e 'raku -Ilib' t
EXTRA_DIST = VERSION cpanfile COPYRIGHT LICENSE CHANGES AUTHORS bootstrap $(PUB) $(wildcard t/*.t) $(POD) $(TEMPL) $(PERLTESTS) $(SHARE) Dockerfile

unit-test:
AGRAMMON_UNIT_TEST=1 prove -j8 -e 'raku -Ilib' t
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.3.0
6.4.0
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ AC_CONFIG_FILES([
Makefile
etc/Makefile
frontend/Makefile
thirdparty/Makefile
])

AC_SUBST(VERSION)
Expand Down
1 change: 1 addition & 0 deletions cpanfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requires 'Excel::Writer::XLSX';
2 changes: 2 additions & 0 deletions dev/META6.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"DB::Pg",
"Digest::SHA1::Native",
"Email::MIME",
"Inline::Perl5",
"IO::Path::ChildSecure",
"IO::String",
"LibXML:ver<0.7.9+>",
Expand All @@ -29,6 +30,7 @@
"OO::Monitors",
"Shell::Command",
"Spreadsheet::XLSX:ver<0.2.4+>",
"Temp::Path",
"Text::CSV",
"YAMLish",
"Cro::APIToken",
Expand Down
8 changes: 4 additions & 4 deletions lib/Agrammon/OutputFormatter/ExcelFast.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use Agrammon::Web::SessionUser;
#use Spreadsheet::XLSX;
#use Spreadsheet::XLSX::Styles;

use Temp::Path;
use Excel::Writer::XLSX:from<Perl5>;

sub input-output-as-excel(
Expand All @@ -19,9 +20,8 @@ sub input-output-as-excel(
Bool $include-filters, Bool $all-filters
) is export {

my $temp-filename = "$dataset-name.xlsx";

my $workbook = Excel::Writer::XLSX.new($temp-filename);
my $temp-file = make-temp-path :suffix<.xlsx>;
my $workbook = Excel::Writer::XLSX.new($temp-file.absolute);

# prepare sheets
my $output-sheet = $workbook.add_worksheet('Ergebnisse');
Expand Down Expand Up @@ -162,5 +162,5 @@ sub input-output-as-excel(
$row-formatted++;
}
$workbook.close();
return $temp-filename.IO.slurp: :bin;
return $temp-file.slurp: :bin;
}
6 changes: 3 additions & 3 deletions lib/Agrammon/UI/CommandLine.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ multi sub MAIN('web', Str $model-filename, ExistingFile :$cfg-file, Str :$techni
multi sub MAIN('run', Str $filename, ExistingFileOrStdin $input, ExistingFile :$cfg-file, Str :$technical-file,
SupportedLanguage :$language = 'de', Str :$print-only, Int :$report-selected, Str :$variants = 'Base',
Bool :$include-filters, Bool :$include-all-filters=False, Int :$batch=1, Int :$degree=4, Int :$max-runs,
OutputFormat :$format = 'text', Str :$export-filename='test.xlsx'
OutputFormat :$format = 'text', Str :$export-filename='test'
) is export {
my @print-set = $print-only.split(',') if $print-only;
my $data = run $filename, $input.IO, $technical-file, $variants, $format, $language, @print-set,
Expand Down Expand Up @@ -98,8 +98,8 @@ multi sub MAIN('run', Str $filename, ExistingFileOrStdin $input, ExistingFile :$
}
for %sim-results.keys.sort -> $dataset {
if $format eq 'excel' {
spurt "$export-filename.xlsx", %sim-results{$dataset};
return;
$export-filename //= $dataset;
spurt "$export-filename-$dataset.xlsx", %sim-results{$dataset};
}
else {
@output.push("# Dataset $dataset");
Expand Down
4 changes: 3 additions & 1 deletion lib/Agrammon/Web/Routes.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,9 @@ sub frontend-api-routes (Str $schema, $ws) {
request-body -> %params {
# prevent header injection
my $filename = cleanup-filename "%params<datasetName>.xlsx";
my $excel = $ws.get-excel-export($user, %params).to-blob;
# use with Excel.pm
# my $excel = $ws.get-excel-export($user, %params).to-blob;
my $excel = $ws.get-excel-export($user, %params);
header 'Content-disposition', qq{attachment; filename="$filename"};
content 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', $excel;
CATCH {
Expand Down
2 changes: 2 additions & 0 deletions share/Models/version6/Livestock/DairyCow/Excretion.nhd
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ Richner, W., Flisch, R., Mayer, J., Schlegel, P., Zähner, M., Menzi, H., 2017.
?endif

### just for testing hidden inputs
?if TESTING
+hiddenAnimals
type = float
hidden = true
Expand All @@ -185,6 +186,7 @@ Richner, W., Flisch, R., Mayer, J., Schlegel, P., Zähner, M., Menzi, H., 2017.
en = -
++description
Just for testing.
?endif

*** technical ***

Expand Down
54 changes: 54 additions & 0 deletions thirdparty/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright (C) 2023 Fritz Zaucker

AUTOMAKE_OPTIONS = foreign

THIRDPARTY_DIR := $(shell pwd)

CPANSNAPV := cpanfile-$(shell $(PERL) -MConfig -e 'my $$v = $$Config{version}; $$v =~ s/\.\d+$$//; print $$v').snapshot


#EXTRA_DIST = $(THIRDPARTY_DIST) $(wildcard bin/cpanm)
EXTRA_DIST = bin/cpanm $(wildcard cpanfile*snapshot)

all-local: touch

touch: bin/cpanm $(CPANSNAPV)
$(AM_V_at)echo "** Installing Dependencies using $(CPANSNAPV)"
cp $(CPANSNAPV) ../cpanfile.snapshot
test -x carton/bin/carton || PERL_CPANM_OPT= PERL_CPANM_HOME=$(THIRDPARTY_DIR) $(PERL) bin/cpanm -q --notest --local-lib-contained $(THIRDPARTY_DIR)/carton Carton Date::Parse
# if ever DBD::ODBC is compiled, make sure we get the utf8 version
PERL_CPANM_OPT= PERL_CPANM_HOME=$(THIRDPARTY_DIR) DBD_ODBC_UNICODE=1 PERL5LIB=$(THIRDPARTY_DIR)/carton/lib/perl5 PERL_CARTON_PATH=$(THIRDPARTY_DIR) $(PERL) $(THIRDPARTY_DIR)/carton/bin/carton install
$(AM_V_at)rm -f ../cpanfile.snapshot
$(AM_V_at)touch touch

bin/cpanm:
$(AM_V_at)mkdir -p bin
$(URL_CAT) https://cpanmin.us > bin/cpanm
$(AM_V_at)chmod 755 bin/cpanm

$(CPANSNAPV): ../cpanfile
$(AM_V_at)echo "** Installing Dependencies using Carton install"
test -f $(CPANSNAPV) && cp $(CPANSNAPV) ../cpanfile.snapshot || true
test -x carton/bin/carton || PERL_CPANM_OPT= PERL_CPANM_HOME=$(THIRDPARTY_DIR) $(PERL) bin/cpanm -q --notest --local-lib-contained $(THIRDPARTY_DIR)/carton Carton Date::Parse
# if ever DBD::ODBC is compiled, make sure we get the utf8 version
PERL_CPANM_OPT= PERL_CPANM_HOME=$(THIRDPARTY_DIR) DBD_ODBC_UNICODE=1 PERL5LIB=$(THIRDPARTY_DIR)/carton/lib/perl5 PERL_CARTON_PATH=$(THIRDPARTY_DIR) $(PERL) $(THIRDPARTY_DIR)/carton/bin/carton install
mv ../cpanfile.snapshot $(CPANSNAPV)
$(AM_V_at)touch touch

update: $(CPANSNAPV)
$(AM_V_at)echo "** Updating Dependencies using Carton update"
$(AM_V_at)cp $(CPANSNAPV) ../cpanfile.snapshot
$(AM_V_at)PERL_CPANM_OPT= PERL_CPANM_HOME=$(THIRDPARTY_DIR) PERL5LIB=$(THIRDPARTY_DIR)/carton/lib/perl5 PERL_CARTON_PATH=$(THIRDPARTY_DIR) $(PERL) $(THIRDPARTY_DIR)/carton/bin/carton update
$(AM_V_at)mv ../cpanfile.snapshot $(CPANSNAPV)

clean-local:
ls -1 | grep -v Makefile | grep -v cpanfile |grep -v bin | xargs rm -rf

distclean-local:
ls -1 | grep -v Makefile | grep -v cpanfile | xargs rm -rf

install-exec-hook:
cp -fr lib/perl5/* $(DESTDIR)$(libdir)
cp -f bin/cover $(DESTDIR)$(bindir)
$(AM_V_at)echo "** Patching cover command"
$(PERL) -i -p -e 's{use warnings;}{use warnings;\nuse lib qw($(libdir));}' $(DESTDIR)$(bindir)/cover
Loading