DEV-573: Fix broken phase lookup for Shared Print reporting purposes #286
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem (https://hathitrust.atlassian.net/browse/DEV-573):
We are currently using
committed_date
to determine which "phase" a commitment belongs to. Meaning, when we want to e.g. look up commitments in phase 3, we have to look up "what's the date associated with phase 3" and query on that committed_date. This, in combination with sloppy date formatting and servers in different timezones, has led to issues with timezone confusion.Proposed solution:
phase
tolib/clusterable/commitment.rb
.committed_date
, but don't use it as a proxy for phase.phase
values to commitments, based on date.commitments.phase
.Steps toward solution:
bin/inspect_ocn.rb
to look up multiple ocns, and output them in a format thatbash phctl.sh load cluster-file
can load, for testing purposes.bin/inspect_ocn.rb
).phase
as a field toClusterable::Commitment
and a corresponding index.SharedPrint::Finder
and updatedSharedPrint::Phases
.committed_date
from production:lib/shared_print/select_distinct_phases.rb
lib/shared_print/phase_updater.rb
Guide to files changed:
bin/inspect_ocn.rb
:Enable lookup of multiple ocns.
Enable output of multiple clusters.
This makes it easier to copy clusters from production and loading them in dev/test (
phctl load cluster-file
)lib/clusterable/commitment.rb
:Added phase field and validation.
lib/shared_print/finder.rb
:Enable lookup by phase.
Simplify some of the stuff that was using committed_date.
lib/shared_print/phase_3_validator.rb
Sets
phase
andcommitted_date
to appropriate values for phase 3.Broke apart
run
intoload_all
&load_one
so I could test loading more directly.lib/shared_print/phase_updater.rb
:Script to set phase on commitments based on their committed_date.
lib/shared_print/select_distinct_phases.rb
:In order to set phase based on committed_date, we must first have a list of all the committed_date
lib/shared_print/phases.rb
:Added phase constants.
spec/fixtures/shared_print_umich_phase123.json
:3 clusters with commitments, for test purposes.
spec/reports/phase3_oclc_registration_spec.rb
:Using phase instead of committed_date.
spec/shared_print/finder_spec.rb
:Using phase instead of committed_date.
spec/shared_print/phase_3_validator_spec.rb
Added test for
load_one
, broke out reused vars.