Skip to content

Commit

Permalink
Patch Temporarily map media for empty instruments with a transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcota committed Aug 8, 2022
1 parent 967d053 commit 1159c30
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
18 changes: 18 additions & 0 deletions Land.Core/Instruments/Adapters/InstrumentMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

using Empiria.Land.Media;
using Empiria.Land.Media.Adapters;
using Empiria.Land.Registration.Transactions;

namespace Empiria.Land.Instruments.Adapters {

Expand Down Expand Up @@ -45,6 +46,23 @@ static internal InstrumentDto Map(Instrument instrument) {
return dto;
}


static internal InstrumentDto Map(Instrument instrument, LRSTransaction transaction) {
if (!instrument.IsNew && !instrument.IsEmptyInstance) {
return Map(instrument);
}

InstrumentDto dto = Map(instrument);

FixedList<LandMediaPosting> mediaPostings = LandMediaReadServices.TransactionFiles(transaction);

FixedList<LandMediaFileDto> mediaFilesDtos = LandMediaFileMapper.Map(mediaPostings);

dto.Media = mediaFilesDtos;

return dto;
}

} // class InstrumentMapper

} // namespace Empiria.Land.Instruments.Adapters
4 changes: 1 addition & 3 deletions Land.Core/Registration/Adapters/InstrumentRecordingMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ static internal InstrumentRecordingDto Map(RecordingDocument instrumentRecording

Instrument instrument = Instrument.Parse(instrumentRecording.InstrumentId);



var actions = new InstrumentRecordingControlData(instrumentRecording, instrument, transaction);

var bookEntries = instrument.RecordingBookEntries;

dto.UID = instrumentRecording.GUID;
dto.InstrumentRecordingID = instrumentRecording.UID;
dto.Instrument = InstrumentMapper.Map(instrument);
dto.Instrument = InstrumentMapper.Map(instrument, transaction);

if (bookEntries.Count > 0) {
dto.BookEntries = RecordingBookMapper.MapBookEntriesListDto(bookEntries);
Expand Down
2 changes: 1 addition & 1 deletion Land.Core/Transactions/Adapters/TransactionMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static internal TransactionPreprocessingDto Map(TransactionPreprocessingData dat
dto.Actions.Show.AntecedentRecordingActs = data.ShowAntecedentRecordingActs;

dto.Media = mediaDto;
dto.Instrument = InstrumentMapper.Map(data.Instrument);
dto.Instrument = InstrumentMapper.Map(data.Instrument, data.Transaction);
dto.Antecedent = data.Antecedent;
dto.AntecedentRecordingActs = data.AntecedentRecordingActs;

Expand Down

0 comments on commit 1159c30

Please sign in to comment.