Permalink
Browse files

Changed incidents order to show newest at top

  • Loading branch information...
1 parent 07e0964 commit 5b23b42032fb7f5b2bb2fb4d4fba4dfe37a5d6f9 @dalezak dalezak committed Jan 28, 2010
Showing with 12 additions and 5 deletions.
  1. +3 −3 Ushahidi.Model/DataManager.cs
  2. +9 −2 Ushahidi.Model/Models/Incidents.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;
@@ -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));
+ }
}
}
}

0 comments on commit 5b23b42

Please sign in to comment.