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

Add problem seed to past answers. #2274

Merged
merged 1 commit into from
Jan 8, 2024

Conversation

drgrice1
Copy link
Member

@drgrice1 drgrice1 commented Dec 6, 2023

Add a problem_seed column to the past_answer database table. This is displayed in the first column of the table shown on the "Answer Log" page. Since that table is not a fully qualified data table and is missing headers, it is displayed in the table as "Seed: 123". If a problem does not have a seed (because it is from a past answer before this pull request like an archived course), then "Seed: unknown" is shown.

Copy link
Member

@taniwallach taniwallach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If recording this, maybe also save the PSVN which is an alternate value which PG can use to seed the RNG?

@drgrice1
Copy link
Member Author

drgrice1 commented Dec 6, 2023

I don't think that the problem set version number is needed in the past answer table. The problem set version number is already saved in the user set. That does not change for the user set, and so it does not also need to be saved in the past answer table, as it can always be retrieved as needed from the user set table.

<td class="px-3"><small><%= $c->formatDateTime($record{time}) %></small></td>
% for (my $i = 0; $i <= $upper_limit; $i++) {
% for (my $i = 0; $i <= $upper_limit; ++$i) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does moving this increment operator to be a prefix make a difference here? Is it a preferable coding standard to use prefix when it doesn't make a difference?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-incrementation should always be used if the value prior to incrementing is not needed. So in a for loop like this it should definitely always be pre-incrementation. No matter what programing language you are working with pre-incrementation is more efficient. Post-incrementation requires saving the original value, incrementing, and returning the original value.

@drgrice1 drgrice1 force-pushed the add-seed-to-past-answer branch from cd4094e to 7ed3f6e Compare December 17, 2023 00:39
Add a `problem_seed` column to the `past_answer` database table.  This
is displayed in the first column of the table shown on the "Answer Log"
page.  Since that table is not a fully qualified data table and is
missing headers, it is displayed in the table as "Seed: 123".  If a
problem does not have a seed (because it is from a past answer before
this pull request like an archived course), then "Seed: unknown" is
shown.
@drgrice1 drgrice1 force-pushed the add-seed-to-past-answer branch from 7ed3f6e to 630db8a Compare January 6, 2024 17:16
@pstaabp pstaabp merged commit 59998c6 into openwebwork:develop Jan 8, 2024
1 check passed
@drgrice1 drgrice1 deleted the add-seed-to-past-answer branch January 8, 2024 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants