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

Prevent images from being regenerated again under a new alias #458

Merged
merged 2 commits into from
May 19, 2020
Merged
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
11 changes: 3 additions & 8 deletions lib/PGcore.pm
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ sub new {
envir => $envir,
WARNING_messages => [],
DEBUG_messages => [],
gifs_created => {},
names_created => 0,
external_refs => {}, # record of external references
%options, # allows overrides and initialization
};
Expand Down Expand Up @@ -724,18 +724,13 @@ PGtikz.pl.

=cut

# Keep track of the names created during this session.
our %names_created;

# Generate a unique file name in a problem based on the user, seed, set
# number, and problem number.
sub getUniqueName {
my $self = shift;
my $ext = shift;
my $prob_name = "$self->{envir}{studentLogin}-$self->{envir}{problemSeed}" .
"-set$self->{envir}{setNumber}prob$self->{envir}{probNum}";
my $num = ++$names_created{$prob_name};
my $resource = $self->{PG_alias}->make_resource_object("$prob_name$num", $ext);
my $num = ++$self->{names_created};
my $resource = $self->{PG_alias}->make_resource_object("name$num", $ext);
$resource->path("__");
return $resource->create_unique_id;
}
Expand Down
1 change: 0 additions & 1 deletion macros/PG.pl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ sub DOCUMENT {
$solutionExists = $PG->{flags}->{solutionExists};
$hintExists = $PG->{flags}->{hintExists};
$pgComment = '';
%gifs_created = %{ $PG->{gifs_created}};
%external_refs = %{ $PG->{external_refs}};

@KEPT_EXTRA_ANSWERS =(); #temporary hack
Expand Down