Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/22/09 15:21:02 (16 years ago)
Author:
msteinbi
Message:

Implementing Lifecycle Management (#453)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Server.Core/JobManager.cs

    r1160 r1170  
    4949    }
    5050
    51     public void ResetJobsDependingOnResults(Job job) {
     51    private JobResult GetLastJobResult(Job job) {
    5252      List<JobResult> allJobResults = new List<JobResult>(jobResultAdapter.GetResultsOf(job));
    5353      JobResult lastJobResult = null;
    5454      foreach (JobResult jR in allJobResults) {
    5555        // if lastJobResult was before the current jobResult the lastJobResult must be updated
    56         if (lastJobResult == null ||         
     56        if (lastJobResult == null ||
    5757            (jR.timestamp > lastJobResult.timestamp))
    5858          lastJobResult = jR;
    5959      }
     60      return lastJobResult;
     61    }
     62
     63    public void ResetJobsDependingOnResults(Job job) {
     64      JobResult lastJobResult = GetLastJobResult(job);
    6065      if (lastJobResult != null) {
    6166        job.Percentage = lastJobResult.Percentage;
     
    127132        }
    128133
     134        job.DateCreated = DateTime.Now;
    129135        jobAdapter.Update(job);
    130136        response.Success = true;
     
    160166    }
    161167
     168    public ResponseObject<JobResult> GetLasJobResultOf(long jobId) {
     169      ResponseObject<JobResult> response = new ResponseObject<JobResult>();
     170      response.Success = true;
     171      response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_RESULT_SENT;
     172      response.Obj = GetLastJobResult(jobAdapter.GetById(jobId));
     173
     174      return response;
     175    }
     176
    162177    #endregion
    163178  }
Note: See TracChangeset for help on using the changeset viewer.