diff options
author | mguetlein <martin.guetlein@gmail.com> | 2011-05-10 12:27:42 +0200 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2011-05-10 12:27:42 +0200 |
commit | b012dc2c3299a829e9fa1bc45b5134c90db451d0 (patch) | |
tree | b48a2aadcba3eda7467e12a204c7cefe7c4126e3 /report/report_persistance.rb | |
parent | 4951f2181a7f2c9c6e04431ff244a6a528dc245a (diff) |
set date when creating validations/crossvalidtions/reports
Diffstat (limited to 'report/report_persistance.rb')
-rwxr-xr-x | report/report_persistance.rb | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/report/report_persistance.rb b/report/report_persistance.rb index 113c81b..c85ad68 100755 --- a/report/report_persistance.rb +++ b/report/report_persistance.rb @@ -191,7 +191,7 @@ module Reports class ReportData < Ohm::Model attribute :report_type - attribute :created_at + attribute :date attribute :validation_uris attribute :crossvalidation_uris attribute :model_uris @@ -203,16 +203,16 @@ module Reports attr_accessor :subjectid + def self.create(params={}) + params[:date] = Time.new + super params + end + def save super OpenTox::Authorization.check_policy(report_uri, subjectid) end - public - def date - created_at - end - def report_uri raise "no id" if self.id==nil Reports::ReportService.instance.get_uri(self.report_type, self.id) @@ -242,10 +242,9 @@ module Reports def new_report(report_content, type, meta_data, uri_provider, subjectid=nil) raise "report meta data missing" unless meta_data - report = ReportData.new(meta_data) + meta_data[:report_type] = type + report = ReportData.create(meta_data) report.subjectid = subjectid - report.report_type = type - report.save OpenTox::Authorization.check_policy(report.report_uri, subjectid) new_report_with_id(report_content, type, report.id) end |