Skip to content

Commit

Permalink
Merge pull request #6 from itpartnersillinois/jonker/GeneralFixes
Browse files Browse the repository at this point in the history
Jonker/general fixes
  • Loading branch information
bryanjonker-illinois authored Jul 22, 2024
2 parents a35bf4f + 353446e commit 7573e91
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions Danielson.Data/PortalTranslator/FormImportInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class FormImportInformation {
public string FinalScoreText { get; set; } = "";
public string FormTemplateInternalLookupString { get; set; } = "";
public bool IsMidterm { get; set; }
public DateTime LastUpdated { get; set; }
public string PlacementType { get; set; } = "";
public string Position { get; set; } = "";
public string Semester { get; set; } = "";
Expand Down
1 change: 1 addition & 0 deletions Danielson/Components/Controls/ComponentItem.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ protected async Task SaveAnswer(int? answer, string answerText, string answerDes
ComponentAnswer.ComponentTitle = Component.Title;
ComponentAnswer.ComponentDescription = answerDescription;
ComponentAnswer.DateCompleted = DateTime.Now;
ComponentAnswer.LastUpdated = DateTime.Now;
ComponentAnswer.DomainItem = Component.DomainEnum;
ComponentAnswer.QualitativeScore = answerText;
ComponentAnswer.QuantitativeScore = answer;
Expand Down
4 changes: 4 additions & 0 deletions Danielson/Components/Pages/Form/Domain.razor
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
}
<DomainItem DomainAnswer="@CurrentForm.GetDomainAnswer(DomainObject.DomainEnum)" OnChangeCallback="AddDomainAnswerToForm"></DomainItem>
</div>
<div>Last changed: @CurrentForm.LastUpdated.ToShortDateString() @CurrentForm.LastUpdated.ToShortTimeString()</div>
<div class="danielson-button-footer">
<button class="il-button il-theme-white" @onclick="ChangePagePrevious" style="float: left;">Previous</button>
<button class="il-button il-theme-white" @onclick="ChangePageNext" style="float: right;">Next</button>
Expand Down Expand Up @@ -85,6 +86,7 @@
<input id="final-signature" aria-required="true" type="checkbox" checked="@CurrentForm.IsSigned" @onchange="CheckFinal"> <span>@FormImportInformation?.EvaluatedBy</span>
<p>You must sign to submit.</p>
</div>
<div>Last changed: @CurrentForm.LastUpdated.ToShortDateString() @CurrentForm.LastUpdated.ToShortTimeString()</div>
<div>
<button class="il-button il-theme-white" @onclick="SaveForm">Submit</button>
</div>
Expand Down Expand Up @@ -117,11 +119,13 @@
<input id="final-signature" disabled type="checkbox" checked="@CurrentForm.IsSigned"> <span>@FormImportInformation?.EvaluatedBy</span>
<p>You must sign to submit.</p>
</div>
<div>Last changed: @CurrentForm.LastUpdated.ToShortDateString() @CurrentForm.LastUpdated.ToShortTimeString()</div>
<div>
<button class="il-button il-theme-white" disabled @onclick="SaveForm" style="background-color: var(--il-gray-1); color: black; border: 2px solid var(--il-button-border-color);">Submit</button>
</div>
}
} else {
<div>Last changed: @CurrentForm.LastUpdated.ToShortDateString() @CurrentForm.LastUpdated.ToShortTimeString()</div>
<div>
<button class="il-button il-theme-white" @onclick="SaveForm">Submit</button>
</div>
Expand Down
15 changes: 13 additions & 2 deletions Danielson/Components/Pages/Form/Domain.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,20 @@ public void ChangeFormType(bool isMidterm) {
NavigationManager.NavigateTo(NavigationManager.Uri, true);
}

protected void AddComponentAnswerToForm(ComponentAnswer componentAnswer) => CurrentForm.AddComponentAnswerToForm(componentAnswer);
protected void AddComponentAnswerToForm(ComponentAnswer componentAnswer) {
CurrentForm.LastUpdated = DateTime.Now;
StateHasChanged();
CurrentForm.AddComponentAnswerToForm(componentAnswer);
}

protected void AddDomainAnswerToForm(DomainAnswer domainAnswer) => CurrentForm.AddDomainAnswerToForm(domainAnswer);
protected void AddDomainAnswerToForm(DomainAnswer domainAnswer) {
CurrentForm.LastUpdated = DateTime.Now;
StateHasChanged();
CurrentForm.AddDomainAnswerToForm(domainAnswer);
}

protected async Task ChangePage(DomainEnum? domainEnum, bool finish) {
CurrentForm.LastUpdated = DateTime.Now;
ShowFinal = finish;
DomainObject = DomainList.Domains.First(d => d.DomainEnum == (finish ? DomainEnum.Four : domainEnum ?? DomainEnum.One));
StateHasChanged();
Expand Down Expand Up @@ -167,6 +176,7 @@ protected override async Task OnInitializedAsync() {
CurrentForm.Title = FormImportInformation.Title;
CurrentForm.FinalSummary = FormImportInformation.FinalScoreText;
CurrentForm.DateEvaluated = FormImportInformation.DateEvaluated;
CurrentForm.LastUpdated = FormImportInformation.LastUpdated;
}
CurrentFormTemplate = await FormTemplateAccess.Get(FormImportInformation.FormTemplateInternalLookupString);
FinalAnswers = FinalAnswerGenerator.GetFinalAnswers(CurrentForm);
Expand All @@ -175,6 +185,7 @@ protected override async Task OnInitializedAsync() {
}

protected async Task SaveForm() {
CurrentForm.LastUpdated = DateTime.Now;
_ = await ComponentAnswerHandler.Save(CurrentForm);
var username = (await AuthenticationStateProvider.GetAuthenticationStateAsync()).User.Identity?.Name ?? "";
_ = await FormImport.Save(CurrentForm, username);
Expand Down

0 comments on commit 7573e91

Please sign in to comment.