-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3211 from SEED-platform/asset-extractor
BuildingSync Asset Extractor Functionality
- Loading branch information
Showing
8 changed files
with
115 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
seed/migrations/0163_add_bae_assets_to_buildingsync_default_profile.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Generated by Django 3.2.12 on 2022-04-14 20:57 | ||
|
||
from django.db import migrations | ||
|
||
from seed.lib.xml_mapping.mapper import default_buildingsync_profile_mappings | ||
|
||
|
||
def recreate_default_bsync_presets(apps, schema_editor): | ||
"""create a default BuildingSync column mapping preset for each organization""" | ||
Organization = apps.get_model("orgs", "Organization") | ||
|
||
# profile number for 'BuildingSync Default' profile is 1 | ||
prof_type = 1 | ||
|
||
for org in Organization.objects.all(): | ||
bsync_mapping_name = 'BuildingSync v2.0 Defaults' | ||
# first find current BuildingSync mapping and delete | ||
profiles = org.columnmappingprofile_set.filter(profile_type=prof_type) | ||
|
||
for prof in profiles: | ||
prof.delete() | ||
|
||
# then recreate including BAE fields with updated "default_buildingsync_profile_mappings" method | ||
org.columnmappingprofile_set.create( | ||
name=bsync_mapping_name, | ||
mappings=default_buildingsync_profile_mappings(), | ||
profile_type=prof_type | ||
) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('seed', '0162_auto_20220418_2257'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(recreate_default_bsync_presets) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters