Skip to content

Commit e650564

Browse files
Fix ecotree channel bug for page 2
1 parent 2b8f2b5 commit e650564

1 file changed

Lines changed: 35 additions & 35 deletions

File tree

tculink/carwings_proto/autodj/opencarwings.py

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -796,45 +796,45 @@ def get_eco_tree_channel(xml_data, returning_xml, channel_id, car, page):
796796

797797
eco_record_slide_img = create_ecorecord_slide(str(slide_title), _("Total:"), trees, _("trees"), tree_records[:3])
798798

799-
response_chdata.append({
800-
'itemId': 1,
801-
'itemFlag1': 0x00,
802-
'dynamicDataField1': encode_utf8(slide_title, limit=0x20),
803-
'dynamicDataField2': encode_utf8(slide_title, limit=0x80),
804-
'dynamicDataField3': b'',
805-
"DMSLocation": b'\xFF' * 10,
806-
'flag2': 0,
807-
'flag3': 0,
808-
'dynamicField4': b'',
809-
# phone num field
810-
'dynamicField5': b'',
811-
'dynamicField6': b'',
812-
'unnamed_data': bytearray(),
813-
# text shown on bottom
814-
"bigDynamicField7": encode_utf8(display_txt, limit=0x400),
815-
"bigDynamicField8": encode_utf8(read_txt, limit=0x400),
816-
"iconField": 0x400,
817-
# annoucnement sound, 1=yes,0=no
818-
"longField2": 1,
819-
"flag4": 1,
820-
"unknownLongId4": 0x0000,
821-
# feature flag? 0xa0 = dial, 0x0F = Img
822-
"flag5": 0x9F,
823-
"flag6": 0xBB,
824-
# image button title
825-
"12byteField1": b'\x00' * 12,
826-
# image name2
827-
"12byteField2": b'\x00' * 12,
828-
"mapPointFlag": b'\x20',
829-
# save flag
830-
"flag8": 0x80,
831-
"imageDataField": eco_record_slide_img,
832-
})
799+
response_chdata.append({
800+
'itemId': 1,
801+
'itemFlag1': 0x00,
802+
'dynamicDataField1': encode_utf8(slide_title, limit=0x20),
803+
'dynamicDataField2': encode_utf8(slide_title, limit=0x80),
804+
'dynamicDataField3': b'',
805+
"DMSLocation": b'\xFF' * 10,
806+
'flag2': 0,
807+
'flag3': 0,
808+
'dynamicField4': b'',
809+
# phone num field
810+
'dynamicField5': b'',
811+
'dynamicField6': b'',
812+
'unnamed_data': bytearray(),
813+
# text shown on bottom
814+
"bigDynamicField7": encode_utf8(display_txt, limit=0x400),
815+
"bigDynamicField8": encode_utf8(read_txt, limit=0x400),
816+
"iconField": 0x400,
817+
# annoucnement sound, 1=yes,0=no
818+
"longField2": 1,
819+
"flag4": 1,
820+
"unknownLongId4": 0x0000,
821+
# feature flag? 0xa0 = dial, 0x0F = Img
822+
"flag5": 0x9F,
823+
"flag6": 0xBB,
824+
# image button title
825+
"12byteField1": b'\x00' * 12,
826+
# image name2
827+
"12byteField2": b'\x00' * 12,
828+
"mapPointFlag": b'\x20',
829+
# save flag
830+
"flag8": 0x80,
831+
"imageDataField": eco_record_slide_img,
832+
})
833833

834834
if page == 2:
835835
forest_title = _("World's Eco Forest")
836836

837-
total_trees = CRMTripRecord.objects.aggregate(trees=Sum('eco_tree_count'))['trees']/5
837+
total_trees = (CRMTripRecord.objects.aggregate(trees=Sum('eco_tree_count'))['trees'] or 0)/5
838838
total_tonnes = round(total_trees*0.00412)
839839
tree_word = _("trees")
840840
tonnes_words = _("tonnes")

0 commit comments

Comments
 (0)