| @@ 224-243 (lines=20) @@ | ||
| 221 | return self.__get_sheet_records(sheet_name) |
|
| 222 | ||
| 223 | # TODO: identical to CRBanim move in a common mixin |
|
| 224 | def __check_items(self, item_set, model, column): |
|
| 225 | """General check of Template items into database""" |
|
| 226 | ||
| 227 | # a list of not found terms and a status to see if something is missing |
|
| 228 | # or not |
|
| 229 | not_found = [] |
|
| 230 | result = True |
|
| 231 | ||
| 232 | for item in item_set: |
|
| 233 | # check for species in database |
|
| 234 | if not model.objects.filter(label=item).exists(): |
|
| 235 | not_found.append(item) |
|
| 236 | ||
| 237 | if len(not_found) != 0: |
|
| 238 | result = False |
|
| 239 | logger.warning( |
|
| 240 | "Those %s are not present in UID database:" % (column)) |
|
| 241 | logger.warning(not_found) |
|
| 242 | ||
| 243 | return result, not_found |
|
| 244 | ||
| 245 | # TODO: nearly identical to CRBanim move in a common mixin |
|
| 246 | def check_species(self, country): |
|
| @@ 191-210 (lines=20) @@ | ||
| 188 | ||
| 189 | # cicle for line |
|
| 190 | ||
| 191 | def __check_items(self, item_set, model, column): |
|
| 192 | """General check of CRBanim items into database""" |
|
| 193 | ||
| 194 | # a list of not found terms and a status to see if something is missing |
|
| 195 | # or not |
|
| 196 | not_found = [] |
|
| 197 | result = True |
|
| 198 | ||
| 199 | for item in item_set: |
|
| 200 | # check for species in database |
|
| 201 | if not model.objects.filter(label=item).exists(): |
|
| 202 | not_found.append(item) |
|
| 203 | ||
| 204 | if len(not_found) != 0: |
|
| 205 | result = False |
|
| 206 | logger.warning( |
|
| 207 | "Those %s are not present in UID database:" % (column)) |
|
| 208 | logger.warning(not_found) |
|
| 209 | ||
| 210 | return result, not_found |
|
| 211 | ||
| 212 | # a function to detect if crbanim species are in UID database or not |
|
| 213 | def check_species(self, country): |
|