|
@@ 579-638 (lines=60) @@
|
| 576 |
|
"poc": obj.getPointOfCapture(), |
| 577 |
|
|
| 578 |
|
}) |
| 579 |
|
|
| 580 |
|
dependencies = self.get_calculation_dependencies_for(obj).values() |
| 581 |
|
info["dependencies"] = map(self.get_base_info, dependencies) |
| 582 |
|
# dependants = self.get_calculation_dependants_for(obj).values() |
| 583 |
|
# info["dependendants"] = map(self.get_base_info, dependants) |
| 584 |
|
return info |
| 585 |
|
|
| 586 |
|
@cache(cache_key) |
| 587 |
|
def get_template_info(self, obj): |
| 588 |
|
"""Returns the info for a Template |
| 589 |
|
""" |
| 590 |
|
client = self.get_client() |
| 591 |
|
client_uid = api.get_uid(client) if client else "" |
| 592 |
|
|
| 593 |
|
profile = obj.getAnalysisProfile() |
| 594 |
|
profile_uid = api.get_uid(profile) if profile else "" |
| 595 |
|
profile_title = profile.Title() if profile else "" |
| 596 |
|
|
| 597 |
|
sample_type = obj.getSampleType() |
| 598 |
|
sample_type_uid = api.get_uid(sample_type) if sample_type else "" |
| 599 |
|
sample_type_title = sample_type.Title() if sample_type else "" |
| 600 |
|
|
| 601 |
|
sample_point = obj.getSamplePoint() |
| 602 |
|
sample_point_uid = api.get_uid(sample_point) if sample_point else "" |
| 603 |
|
sample_point_title = sample_point.Title() if sample_point else "" |
| 604 |
|
|
| 605 |
|
service_uids = [] |
| 606 |
|
analyses_partitions = {} |
| 607 |
|
analyses = obj.getAnalyses() |
| 608 |
|
|
| 609 |
|
for record in analyses: |
| 610 |
|
service_uid = record.get("service_uid") |
| 611 |
|
service_uids.append(service_uid) |
| 612 |
|
analyses_partitions[service_uid] = record.get("partition") |
| 613 |
|
|
| 614 |
|
info = self.get_base_info(obj) |
| 615 |
|
info.update({ |
| 616 |
|
"analyses_partitions": analyses_partitions, |
| 617 |
|
"analysis_profile_title": profile_title, |
| 618 |
|
"analysis_profile_uid": profile_uid, |
| 619 |
|
"client_uid": client_uid, |
| 620 |
|
"composite": obj.getComposite(), |
| 621 |
|
"partitions": obj.getPartitions(), |
| 622 |
|
"remarks": obj.getRemarks(), |
| 623 |
|
"report_dry_matter": obj.getReportDryMatter(), |
| 624 |
|
"sample_point_title": sample_point_title, |
| 625 |
|
"sample_point_uid": sample_point_uid, |
| 626 |
|
"sample_type_title": sample_type_title, |
| 627 |
|
"sample_type_uid": sample_type_uid, |
| 628 |
|
"service_uids": service_uids, |
| 629 |
|
}) |
| 630 |
|
return info |
| 631 |
|
|
| 632 |
|
@cache(cache_key) |
| 633 |
|
def get_profile_info(self, obj): |
| 634 |
|
"""Returns the info for a Profile |
| 635 |
|
""" |
| 636 |
|
info = self.get_base_info(obj) |
| 637 |
|
info.update({}) |
| 638 |
|
return info |
| 639 |
|
|
| 640 |
|
@cache(cache_key) |
| 641 |
|
def get_method_info(self, obj): |
|
@@ 520-577 (lines=58) @@
|
| 517 |
|
}, |
| 518 |
|
"samplinground": { |
| 519 |
|
"getParentUID": [uid], |
| 520 |
|
}, |
| 521 |
|
"sample": { |
| 522 |
|
"getClientUID": [uid], |
| 523 |
|
}, |
| 524 |
|
} |
| 525 |
|
info["filter_queries"] = filter_queries |
| 526 |
|
|
| 527 |
|
return info |
| 528 |
|
|
| 529 |
|
@cache(cache_key) |
| 530 |
|
def get_contact_info(self, obj): |
| 531 |
|
"""Returns the client info of an object |
| 532 |
|
""" |
| 533 |
|
|
| 534 |
|
info = self.get_base_info(obj) |
| 535 |
|
fullname = obj.getFullname() |
| 536 |
|
email = obj.getEmailAddress() |
| 537 |
|
|
| 538 |
|
# Note: It might get a circular dependency when calling: |
| 539 |
|
# map(self.get_contact_info, obj.getCCContact()) |
| 540 |
|
cccontacts = {} |
| 541 |
|
for contact in obj.getCCContact(): |
| 542 |
|
uid = api.get_uid(contact) |
| 543 |
|
fullname = contact.getFullname() |
| 544 |
|
email = contact.getEmailAddress() |
| 545 |
|
cccontacts[uid] = { |
| 546 |
|
"fullname": fullname, |
| 547 |
|
"email": email |
| 548 |
|
} |
| 549 |
|
|
| 550 |
|
info.update({ |
| 551 |
|
"fullname": fullname, |
| 552 |
|
"email": email, |
| 553 |
|
"cccontacts": cccontacts, |
| 554 |
|
}) |
| 555 |
|
|
| 556 |
|
return info |
| 557 |
|
|
| 558 |
|
@cache(cache_key) |
| 559 |
|
def get_service_info(self, obj): |
| 560 |
|
"""Returns the info for a Service |
| 561 |
|
""" |
| 562 |
|
info = self.get_base_info(obj) |
| 563 |
|
|
| 564 |
|
info.update({ |
| 565 |
|
"short_title": obj.getShortTitle(), |
| 566 |
|
"scientific_name": obj.getScientificName(), |
| 567 |
|
"unit": obj.getUnit(), |
| 568 |
|
"report_dry_matter": obj.getReportDryMatter(), |
| 569 |
|
"keyword": obj.getKeyword(), |
| 570 |
|
"methods": map(self.get_method_info, obj.getMethods()), |
| 571 |
|
"calculation": self.get_calculation_info(obj.getCalculation()), |
| 572 |
|
"price": obj.getPrice(), |
| 573 |
|
"currency_symbol": self.get_currency().symbol, |
| 574 |
|
"accredited": obj.getAccredited(), |
| 575 |
|
"category": obj.getCategoryTitle(), |
| 576 |
|
"poc": obj.getPointOfCapture(), |
| 577 |
|
|
| 578 |
|
}) |
| 579 |
|
|
| 580 |
|
dependencies = self.get_calculation_dependencies_for(obj).values() |