Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed incidents order to show newest at top

  • Loading branch information...
commit 5b23b42032fb7f5b2bb2fb4d4fba4dfe37a5d6f9 1 parent 07e0964
@dalezak dalezak authored
View
6 Ushahidi.Model/DataManager.cs
@@ -544,7 +544,7 @@ public static bool DownloadIncidents()
{
Log.Info("DataManager.DownloadIncidents", "serverAddress={0}", ServerAddress);
Incidents = Incidents.Download(IncidentsURL, IncidentsDirectory);
- Incidents.Sort();
+ Incidents.Sort(true);
return Incidents != null;
}
@@ -559,7 +559,7 @@ public static Incidents Incidents
if (_Incidents == null)
{
_Incidents = Incidents.Load(IncidentsDirectory);
- _Incidents.Sort();
+ _Incidents.Sort(true);
}
return _Incidents;
}
@@ -572,7 +572,7 @@ public static Incidents Incidents
public static bool AddIncident(Incident incident)
{
Incidents.Add(incident);
- Incidents.Sort();
+ Incidents.Sort(true);
string fileName = string.Format("{0}.xml", DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss"));
incident.FilePath = Path.Combine(IncidentsDirectory, fileName);
incident.Upload = true;
View
11 Ushahidi.Model/Models/Incidents.cs
@@ -31,9 +31,16 @@ public static Incidents Download(string url, string directory)
/// <summary>
/// Sort Incidents By Date
/// </summary>
- public void Sort()
+ public void Sort(bool descending)
{
- Sort((a, b) => a.Date.CompareTo(b.Date));
+ if (descending)
+ {
+ Sort((a, b) => b.Date.CompareTo(a.Date));
+ }
+ else
+ {
+ Sort((a, b) => a.Date.CompareTo(b.Date));
+ }
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.