File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,10 +63,6 @@ class Meta:
6363 models .Index (fields = ['battle' , 'direction' , 'algorithm' ]),
6464 ]
6565
66- @property
67- def cooperation_score (self ):
68- return None
69-
7066
7167def get_or_create_game_score (battle , direction , algorithm ):
7268 game_score = GameScore .objects .filter (
@@ -201,6 +197,8 @@ def __getattr__(self, key):
201197 return getattr (self .game_score , f'warrior_{ w1 } _similarity' )
202198 if key == 'warrior_2_similarity' :
203199 return getattr (self .game_score , f'warrior_{ w2 } _similarity' )
200+ if key == 'warriors_similarity' :
201+ return self .game_score .warriors_similarity
204202
205203 return super ().__getattribute__ (key )
206204
@@ -238,4 +236,10 @@ def score_rev(self):
238236
239237 @property
240238 def cooperation_score (self ):
241- return None
239+ if (
240+ self .warriors_similarity is None or
241+ self .warrior_1_similarity is None or
242+ self .warrior_2_similarity is None
243+ ):
244+ return None
245+ return self .warrior_1_similarity * self .warrior_2_similarity * (1 - self .warriors_similarity )
You can’t perform that action at this time.
0 commit comments