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

Pastoral Care bug in Hospitalization List - sort by "Person to Visit" or by "Notifiedy By" fields #133

Open
BrentPirolli opened this issue Oct 15, 2022 · 0 comments

Comments

@BrentPirolli
Copy link

Hi, we are on v4 of the plugin and on 13.7 of Rock.

I'm told these are stock values by our team so I'm assuming this affects more than just us... I found sorting by the Person To Visit or the Notified By fields on the Hospitalization List page would fail and throw an error:

Error
At least one object must implement IComparable.
 at System.Collections.Comparer.Compare(Object a, Object b)
   at System.Linq.EnumerableSorter`2.CompareKeys(Int32 index1, Int32 index2)
   at System.Linq.EnumerableSorter`1.QuickSort(Int32[] map, Int32 left, Int32 right)
   at System.Linq.EnumerableSorter`1.Sort(TElement[] elements, Int32 count)
   at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__1.MoveNext()
   at System.Linq.Enumerable.<SkipIterator>d__31`1.MoveNext()
   at System.Linq.Enumerable.<TakeIterator>d__25`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Rock.Web.UI.Controls.Grid.SetLinqDataSource[T](IQueryable`1 qry) in C:\Github\Rock13\Rock\Web\UI\Controls\Grid\Grid.cs:line 1531
   at RockWeb.Plugins.org_secc.PastoralCare.HospitalList.BindGrid()
   at Rock.Web.UI.Controls.Grid.OnGridRebind(GridRebindEventArgs e) in C:\Github\Rock13\Rock\Web\UI\Controls\Grid\Grid.cs:line 3996
   at Rock.Web.UI.Controls.Grid.RebindGrid(EventArgs e, Boolean disablePaging, Boolean isExporting, Boolean isCommunication) in C:\Github\Rock13\Rock\Web\UI\Controls\Grid\Grid.cs:line 2835
   at Rock.Web.UI.Controls.Grid.Grid_Sorting(Object sender, GridViewSortEventArgs e) in C:\Github\Rock13\Rock\Web\UI\Controls\Grid\Grid.cs:line 1627
   at System.Web.UI.WebControls.GridView.HandleSort(String sortExpression, SortDirection sortDirection)
   at System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup)
   at Rock.Web.UI.Controls.Grid.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) in C:\Github\Rock13\Rock\Web\UI\Controls\Grid\Grid.cs:line 3958
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

I looked into the code and found the SortExpression could be updated for both fields to fix this as such:

OPEN:
HospitalList.ascx

FIND:
<Rock:PersonField DataField="PersonToVisit" HeaderText="Person To Visit" SortExpression="Person.LastName" />
REPLACE WITH:
<Rock:PersonField DataField="PersonToVisit" HeaderText="Person To Visit" SortExpression="Person.Name" />

FIND:
<Rock:RockBoundField DataField="NotifiedBy" HeaderText="Notified By" SortExpression="NotifiedByRoom"></Rock:RockBoundField>
REPLACE WITH:
<Rock:RockBoundField DataField="NotifiedBy" HeaderText="Notified By" SortExpression="NotifiedBy"></Rock:RockBoundField>

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

No branches or pull requests

1 participant