Any election officer serving at any school district election or community college district election may be paid out of the funds of the district as compensation for his or her services as an election officer a sum determined by the county elections official and approved by the county board of supervisors, not to exceed the amount paid from the county treasury to officers of the preceding general election. In districts in which the polls are kept open less than 12 hours, the maximum compensation for election officers shall be the sum bearing the same relation to the amount paid to election officers of the last preceding general election as the number of hours the polls were open at the election bears to the number of hours the polls were open in the preceding general election.